Re: [PATCH 04/10] fs: Propagate shrinker::id to list_lru

From: Vladimir Davydov
Date: Sat Mar 24 2018 - 14:50:26 EST


On Wed, Mar 21, 2018 at 04:21:51PM +0300, Kirill Tkhai wrote:
> The patch adds list_lru::shrk_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 | 5 +++++
> include/linux/list_lru.h | 1 +
> mm/list_lru.c | 7 ++++++-
> mm/workingset.c | 3 +++
> 4 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/fs/super.c b/fs/super.c
> index 0660083427fa..1f3dc4eab409 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -521,6 +521,11 @@ struct super_block *sget_userns(struct file_system_type *type,
> if (err) {
> deactivate_locked_super(s);
> s = ERR_PTR(err);
> + } else {
> +#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB)
> + s->s_dentry_lru.shrk_id = s->s_shrink.id;
> + s->s_inode_lru.shrk_id = s->s_shrink.id;
> +#endif

I don't really like the new member name. Let's call it shrink_id or
shrinker_id, shall we?

Also, I think we'd better pass shrink_id to list_lru_init rather than
setting it explicitly.