[PATCH -mm v15 10/13] fs: make shrinker memcg aware

2014-02-05 Thread Vladimir Davydov
Now, to make any list_lru-based shrinker memcg aware we should only
initialize its list_lru as memcg-enabled. Let's do it for the general FS
shrinker (super_block::s_shrink) and mark it as memcg aware.

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 may be shared among different cgroups, there is no
point making them memcg aware.

Signed-off-by: Vladimir Davydov 
Cc: Glauber Costa 
Cc: Dave Chinner 
Cc: Al Viro 
---
 fs/super.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index 33cbff3769e7..6a58a7196fb2 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -191,9 +191,9 @@ static struct super_block *alloc_super(struct 
file_system_type *type, int flags)
INIT_LIST_HEAD(>s_inodes);
INIT_WORK(>destroy, destroy_super_work_func);
 
-   if (list_lru_init(>s_dentry_lru))
+   if (list_lru_init_memcg(>s_dentry_lru))
goto fail;
-   if (list_lru_init(>s_inode_lru))
+   if (list_lru_init_memcg(>s_inode_lru))
goto fail;
 
init_rwsem(>s_umount);
@@ -230,7 +230,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:
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH -mm v15 10/13] fs: make shrinker memcg aware

2014-02-05 Thread Vladimir Davydov
Now, to make any list_lru-based shrinker memcg aware we should only
initialize its list_lru as memcg-enabled. Let's do it for the general FS
shrinker (super_block::s_shrink) and mark it as memcg aware.

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 may be shared among different cgroups, there is no
point making them memcg aware.

Signed-off-by: Vladimir Davydov vdavy...@parallels.com
Cc: Glauber Costa glom...@openvz.org
Cc: Dave Chinner dchin...@redhat.com
Cc: Al Viro v...@zeniv.linux.org.uk
---
 fs/super.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/super.c b/fs/super.c
index 33cbff3769e7..6a58a7196fb2 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -191,9 +191,9 @@ static struct super_block *alloc_super(struct 
file_system_type *type, int flags)
INIT_LIST_HEAD(s-s_inodes);
INIT_WORK(s-destroy, destroy_super_work_func);
 
-   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);
@@ -230,7 +230,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:
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/