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: Vladimir 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Родитель
60d3fd32a7
Коммит
2acb60a046
|
@ -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_LIST_HEAD(&s->s_inodes);
|
||||
|
||||
if (list_lru_init(&s->s_dentry_lru))
|
||||
if (list_lru_init_memcg(&s->s_dentry_lru))
|
||||
goto fail;
|
||||
if (list_lru_init(&s->s_inode_lru))
|
||||
if (list_lru_init_memcg(&s->s_inode_lru))
|
||||
goto fail;
|
||||
|
||||
init_rwsem(&s->s_umount);
|
||||
|
@ -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.count_objects = super_cache_count;
|
||||
s->s_shrink.batch = 1024;
|
||||
s->s_shrink.flags = SHRINKER_NUMA_AWARE;
|
||||
s->s_shrink.flags = SHRINKER_NUMA_AWARE | SHRINKER_MEMCG_AWARE;
|
||||
return s;
|
||||
|
||||
fail:
|
||||
|
|
Загрузка…
Ссылка в новой задаче