提交 2acb60a0 编写于 作者: V Vladimir Davydov 提交者: Linus Torvalds

fs: make shrinker memcg aware

Now, to make any list_lru-based shrinker memcg aware we should only
initialize its list_lru as memcg aware.  Let's do it for the general FS
shrinker (super_block::s_shrink).

There are other FS-specific shrinkers that use list_lru for storing
objects, such as XFS and GFS2 dquot cache shrinkers, but since they
reclaim objects that are shared among different cgroups, there is no point
making them memcg aware.  It's a big question whether we should account
them to memcg at all.
Signed-off-by: NVladimir Davydov <vdavydov@parallels.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Greg Thelen <gthelen@google.com>
Cc: Glauber Costa <glommer@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 60d3fd32
...@@ -189,9 +189,9 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags) ...@@ -189,9 +189,9 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
INIT_HLIST_BL_HEAD(&s->s_anon); INIT_HLIST_BL_HEAD(&s->s_anon);
INIT_LIST_HEAD(&s->s_inodes); INIT_LIST_HEAD(&s->s_inodes);
if (list_lru_init(&s->s_dentry_lru)) if (list_lru_init_memcg(&s->s_dentry_lru))
goto fail; goto fail;
if (list_lru_init(&s->s_inode_lru)) if (list_lru_init_memcg(&s->s_inode_lru))
goto fail; goto fail;
init_rwsem(&s->s_umount); init_rwsem(&s->s_umount);
...@@ -227,7 +227,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags) ...@@ -227,7 +227,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
s->s_shrink.scan_objects = super_cache_scan; s->s_shrink.scan_objects = super_cache_scan;
s->s_shrink.count_objects = super_cache_count; s->s_shrink.count_objects = super_cache_count;
s->s_shrink.batch = 1024; s->s_shrink.batch = 1024;
s->s_shrink.flags = SHRINKER_NUMA_AWARE; s->s_shrink.flags = SHRINKER_NUMA_AWARE | SHRINKER_MEMCG_AWARE;
return s; return s;
fail: fail:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册