The patch titled Subject: fs: propagate shrinker::id to list_lru has been added to the -mm tree. Its filename is fs-propagate-shrinker-id-to-list_lru.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/fs-propagate-shrinker-id-to-list_lru.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/fs-propagate-shrinker-id-to-list_lru.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Kirill Tkhai <ktkhai@xxxxxxxxxxxxx> Subject: fs: propagate shrinker::id to list_lru 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. Link: http://lkml.kernel.org/r/153063059758.1818.14866596416857717800.stgit@localhost.localdomain Signed-off-by: Kirill Tkhai <ktkhai@xxxxxxxxxxxxx> Acked-by: Vladimir Davydov <vdavydov.dev@xxxxxxxxx> Tested-by: Shakeel Butt <shakeelb@xxxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Guenter Roeck <linux@xxxxxxxxxxxx> Cc: "Huang, Ying" <ying.huang@xxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Josef Bacik <jbacik@xxxxxx> Cc: Li RongQing <lirongqing@xxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Matthias Kaehlcke <mka@xxxxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Minchan Kim <minchan@xxxxxxxxxx> Cc: Philippe Ombredanne <pombredanne@xxxxxxxx> Cc: Roman Gushchin <guro@xxxxxx> Cc: Sahitya Tummala <stummala@xxxxxxxxxxxxxx> Cc: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> Cc: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Waiman Long <longman@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/super.c | 4 ++-- include/linux/list_lru.h | 15 ++++++++------- mm/list_lru.c | 11 ++++++++++- mm/workingset.c | 3 ++- 4 files changed, 22 insertions(+), 11 deletions(-) diff -puN fs/super.c~fs-propagate-shrinker-id-to-list_lru fs/super.c --- a/fs/super.c~fs-propagate-shrinker-id-to-list_lru +++ a/fs/super.c @@ -261,9 +261,9 @@ static struct super_block *alloc_super(s s->s_shrink.flags = SHRINKER_NUMA_AWARE | SHRINKER_MEMCG_AWARE; if (prealloc_shrinker(&s->s_shrink)) goto fail; - if (list_lru_init_memcg(&s->s_dentry_lru)) + if (list_lru_init_memcg(&s->s_dentry_lru, &s->s_shrink)) goto fail; - if (list_lru_init_memcg(&s->s_inode_lru)) + if (list_lru_init_memcg(&s->s_inode_lru, &s->s_shrink)) goto fail; return s; diff -puN include/linux/list_lru.h~fs-propagate-shrinker-id-to-list_lru include/linux/list_lru.h --- a/include/linux/list_lru.h~fs-propagate-shrinker-id-to-list_lru +++ a/include/linux/list_lru.h @@ -54,19 +54,20 @@ struct list_lru { bool lock_irq; #ifdef CONFIG_MEMCG_KMEM struct list_head list; + int shrinker_id; #endif }; void list_lru_destroy(struct list_lru *lru); int __list_lru_init(struct list_lru *lru, bool memcg_aware, bool lock_irq, - struct lock_class_key *key); + struct lock_class_key *key, struct shrinker *shrinker); -#define list_lru_init(lru) __list_lru_init((lru), false, false, \ - NULL) -#define list_lru_init_key(lru, key) __list_lru_init((lru), false, false, \ - (key)) -#define list_lru_init_memcg(lru) __list_lru_init((lru), true, false, \ - NULL) +#define list_lru_init(lru) \ + __list_lru_init((lru), false, false, NULL, NULL) +#define list_lru_init_key(lru, key) \ + __list_lru_init((lru), false, false, (key), NULL) +#define list_lru_init_memcg(lru, shrinker) \ + __list_lru_init((lru), true, false, NULL, shrinker) int memcg_update_all_list_lrus(int num_memcgs); void memcg_drain_all_list_lrus(int src_idx, int dst_idx); diff -puN mm/list_lru.c~fs-propagate-shrinker-id-to-list_lru mm/list_lru.c --- a/mm/list_lru.c~fs-propagate-shrinker-id-to-list_lru +++ a/mm/list_lru.c @@ -552,12 +552,18 @@ static void memcg_destroy_list_lru(struc #endif /* CONFIG_MEMCG_KMEM */ int __list_lru_init(struct list_lru *lru, bool memcg_aware, bool lock_irq, - struct lock_class_key *key) + struct lock_class_key *key, struct shrinker *shrinker) { int i; size_t size = sizeof(*lru->node) * nr_node_ids; int err = -ENOMEM; +#ifdef CONFIG_MEMCG_KMEM + if (shrinker) + lru->shrinker_id = shrinker->id; + else + lru->shrinker_id = -1; +#endif memcg_get_cache_ids(); lru->node = kzalloc(size, GFP_KERNEL); @@ -600,6 +606,9 @@ void list_lru_destroy(struct list_lru *l 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); diff -puN mm/workingset.c~fs-propagate-shrinker-id-to-list_lru mm/workingset.c --- a/mm/workingset.c~fs-propagate-shrinker-id-to-list_lru +++ a/mm/workingset.c @@ -522,7 +522,8 @@ static int __init workingset_init(void) if (ret) goto err; /* list_lru lock nests inside the IRQ-safe i_pages lock */ - ret = __list_lru_init(&shadow_nodes, true, true, &shadow_nodes_key); + ret = __list_lru_init(&shadow_nodes, true, true, &shadow_nodes_key, + &workingset_shadow_shrinker); if (ret) goto err_list_lru; register_shrinker_prepared(&workingset_shadow_shrinker); _ Patches currently in -mm which might be from ktkhai@xxxxxxxxxxxxx are memcg-remove-memcg_cgroup-id-from-idr-on-mem_cgroup_css_alloc-failure.patch list_lru-combine-code-under-the-same-define.patch mm-introduce-config_memcg_kmem-as-combination-of-config_memcg-config_slob.patch mm-assign-id-to-every-memcg-aware-shrinker.patch memcg-move-up-for_each_mem_cgroup-_tree-defines.patch mm-assign-memcg-aware-shrinkers-bitmap-to-memcg.patch mm-refactoring-in-workingset_init.patch fs-refactoring-in-alloc_super.patch fs-propagate-shrinker-id-to-list_lru.patch list_lru-add-memcg-argument-to-list_lru_from_kmem.patch list_lru-pass-dst_memcg-argument-to-memcg_drain_list_lru_node.patch list_lru-pass-lru-argument-to-memcg_drain_list_lru_node.patch mm-export-mem_cgroup_is_root.patch mm-set-bit-in-memcg-shrinker-bitmap-on-first-list_lru-item-apearance.patch mm-iterate-only-over-charged-shrinkers-during-memcg-shrink_slab.patch mm-add-shrink_empty-shrinker-methods-return-value.patch mm-clear-shrinker-bit-if-there-are-no-objects-related-to-memcg.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html