aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Davydov <vdavydov@parallels.com>2015-02-12 17:59:14 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-12 21:54:09 -0500
commit2acb60a0461fec8a4516686c913a295ce872697f (patch)
treeaa4e36d78f28e5164041e861064db101405659e4
parent60d3fd32a7a9da4c8c93a9f89cfda22a0b4c65ce (diff)
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>
-rw-r--r--fs/super.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/super.c b/fs/super.c
index b027849d92d2..482b4071f4de 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -189,9 +189,9 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
189 INIT_HLIST_BL_HEAD(&s->s_anon); 189 INIT_HLIST_BL_HEAD(&s->s_anon);
190 INIT_LIST_HEAD(&s->s_inodes); 190 INIT_LIST_HEAD(&s->s_inodes);
191 191
192 if (list_lru_init(&s->s_dentry_lru)) 192 if (list_lru_init_memcg(&s->s_dentry_lru))
193 goto fail; 193 goto fail;
194 if (list_lru_init(&s->s_inode_lru)) 194 if (list_lru_init_memcg(&s->s_inode_lru))
195 goto fail; 195 goto fail;
196 196
197 init_rwsem(&s->s_umount); 197 init_rwsem(&s->s_umount);
@@ -227,7 +227,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
227 s->s_shrink.scan_objects = super_cache_scan; 227 s->s_shrink.scan_objects = super_cache_scan;
228 s->s_shrink.count_objects = super_cache_count; 228 s->s_shrink.count_objects = super_cache_count;
229 s->s_shrink.batch = 1024; 229 s->s_shrink.batch = 1024;
230 s->s_shrink.flags = SHRINKER_NUMA_AWARE; 230 s->s_shrink.flags = SHRINKER_NUMA_AWARE | SHRINKER_MEMCG_AWARE;
231 return s; 231 return s;
232 232
233fail: 233fail: