[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <613dda66-4fa6-1820-50c4-c7b28235e687@suse.cz>
Date: Tue, 26 May 2020 12:52:24 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Roman Gushchin <guro@...com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>, linux-mm@...ck.org,
kernel-team@...com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 15/19] mm: memcg/slab: deprecate slab_root_caches
On 4/22/20 10:47 PM, Roman Gushchin wrote:
> Currently there are two lists of kmem_caches:
> 1) slab_caches, which contains all kmem_caches,
> 2) slab_root_caches, which contains only root kmem_caches.
>
> And there is some preprocessor magic to have a single list
> if CONFIG_MEMCG_KMEM isn't enabled.
>
> It was required earlier because the number of non-root kmem_caches
> was proportional to the number of memory cgroups and could reach
> really big values. Now, when it cannot exceed the number of root
> kmem_caches, there is really no reason to maintain two lists.
>
> We never iterate over the slab_root_caches list on any hot paths,
> so it's perfectly fine to iterate over slab_caches and filter out
> non-root kmem_caches.
>
> It allows to remove a lot of config-dependent code and two pointers
> from the kmem_cache structure.
>
> Signed-off-by: Roman Gushchin <guro@...com>
Reviewed-by: Vlastimil Babka <vbabka@...e.cz>
> @@ -1148,11 +1126,12 @@ static void cache_show(struct kmem_cache *s, struct seq_file *m)
>
> static int slab_show(struct seq_file *m, void *p)
> {
> - struct kmem_cache *s = list_entry(p, struct kmem_cache, root_caches_node);
> + struct kmem_cache *s = list_entry(p, struct kmem_cache, list);
>
> - if (p == slab_root_caches.next)
> + if (p == slab_caches.next)
> print_slabinfo_header(m);
> - cache_show(s, m);
> + if (is_root_cache(s))
> + cache_show(s, m);
If there wasn't patch 17/19 we could just remove this condition and have
/proc/slabinfo contain the -memcg variants?
Powered by blists - more mailing lists