[RHEL7,COMMIT] ms/fs: propagate shrinker::id to list_lru

Submitted by Konstantin Khorenko on Sept. 5, 2018, 9:37 a.m.

Details

Message ID 201809050937.w859bA7f010095@finist_ce7.work
State New
Series "Port "Improve shrink_slab() scalability" patchset"
Headers show

Commit Message

Konstantin Khorenko Sept. 5, 2018, 9:37 a.m.
The commit is pushed to "branch-rh7-3.10.0-862.11.6.vz7.71.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.11.6.vz7.71.8
------>
commit ae87e8cb865fa68a8e44cf28bbae654001190218
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Wed Sep 5 12:37:10 2018 +0300

    ms/fs: propagate shrinker::id to list_lru
    
    ms commit c92e8e10cafe (modified)
    
    Add list_lru::shrinker_id field and populate it by registered shrinker id.
    
    This will be used to set correct bit in memcg shrinkers map by lru code
    in next patches, after there appeared the first related to memcg element
    in list_lru.
    
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
    
    =====================
    Patchset description:
    
    Port "Improve shrink_slab() scalability" patchset
    
    https://jira.sw.ru/browse/PSBM-88027
    
    This is backport of the patchset improving the performance
    of overcommited containers with many memcgs and mounts.
    The original set is in Linus' tree, and came into 4.19-rc1.
    
    Kirill Tkhai (12):
          mm: assign id to every memcg-aware shrinker
          mm/memcontrol.c: move up for_each_mem_cgroup{, _tree} defines
          mm, memcg: assign memcg-aware shrinkers bitmap to memcg
          fs: propagate shrinker::id to list_lru
          mm/list_lru.c: add memcg argument to list_lru_from_kmem()
          mm/list_lru: pass dst_memcg argument to memcg_drain_list_lru_node()
          mm/list_lru.c: pass lru argument to memcg_drain_list_lru_node()
          mm/list_lru.c: set bit in memcg shrinker bitmap on first list_lru item appearance
          mm/memcontrol.c: export mem_cgroup_is_root()
          mm/vmscan.c: iterate only over charged shrinkers during memcg shrink_slab()
          mm: add SHRINK_EMPTY shrinker methods return value
          mm/vmscan.c: clear shrinker bit if there are no objects related to memcg
    
    Vladimir Davydov (1):
          mm/vmscan.c: generalize shrink_slab() calls in shrink_node()
---
 fs/super.c               | 3 +++
 include/linux/list_lru.h | 1 +
 mm/list_lru.c            | 7 +++++++
 3 files changed, 11 insertions(+)

Patch hide | download patch | download mbox

diff --git a/fs/super.c b/fs/super.c
index 7e6352370a45..162ca145940f 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -543,6 +543,9 @@  struct super_block *sget_userns(struct file_system_type *type,
 		deactivate_locked_super(s);
 		s = ERR_PTR(err);
 	}
+
+	s->s_dentry_lru.shrinker_id = s->s_shrink.id;
+	s->s_inode_lru.shrinker_id = s->s_shrink.id;
 	return s;
 }
 
diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h
index 00a339b9415d..aee40a87360c 100644
--- a/include/linux/list_lru.h
+++ b/include/linux/list_lru.h
@@ -51,6 +51,7 @@  struct list_lru {
 	struct list_lru_node	*node;
 #ifdef CONFIG_MEMCG_KMEM
 	struct list_head	list;
+	int			shrinker_id;
 #endif
 };
 
diff --git a/mm/list_lru.c b/mm/list_lru.c
index 91dccc1e30bf..514a862717c5 100644
--- a/mm/list_lru.c
+++ b/mm/list_lru.c
@@ -543,6 +543,10 @@  int __list_lru_init(struct list_lru *lru, bool memcg_aware,
 
 	memcg_get_cache_ids();
 
+#ifdef CONFIG_MEMCG_KMEM
+	lru->shrinker_id = -1;
+#endif
+
 	lru->node = kzalloc(size, GFP_KERNEL);
 	if (!lru->node)
 		goto out;
@@ -583,6 +587,9 @@  void list_lru_destroy(struct list_lru *lru)
 	kfree(lru->node);
 	lru->node = NULL;
 
+#ifdef CONFIG_MEMCG_KMEM
+	lru->shrinker_id = -1;
+#endif
 	memcg_put_cache_ids();
 }
 EXPORT_SYMBOL_GPL(list_lru_destroy);