On Thu, May 10, 2018 at 12:53:06PM +0300, Kirill Tkhai wrote: > The patch adds list_lru::shrinker_id field, and populates > 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@xxxxxxxxxxxxx> > --- > fs/super.c | 4 ++++ > include/linux/list_lru.h | 3 +++ > mm/list_lru.c | 6 ++++++ > mm/workingset.c | 3 +++ > 4 files changed, 16 insertions(+) > > diff --git a/fs/super.c b/fs/super.c > index 2ccacb78f91c..dfa85e725e45 100644 > --- a/fs/super.c > +++ b/fs/super.c > @@ -258,6 +258,10 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, > goto fail; > if (list_lru_init_memcg(&s->s_inode_lru)) > goto fail; > +#ifdef CONFIG_MEMCG_SHRINKER > + s->s_dentry_lru.shrinker_id = s->s_shrink.id; > + s->s_inode_lru.shrinker_id = s->s_shrink.id; > +#endif I don't like this. Can't you simply pass struct shrinker to list_lru_init_memcg() and let it extract the id?