[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <83135334-f85e-b587-82fe-1875de602f53@suse.cz>
Date: Thu, 6 May 2021 18:02:45 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Waiman Long <longman@...hat.com>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
Vladimir Davydov <vdavydov.dev@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Roman Gushchin <guro@...com>,
Shakeel Butt <shakeelb@...gle.com>
Cc: linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH v4 3/3] mm: memcg/slab: Disable cache merging for
KMALLOC_NORMAL caches
On 5/5/21 10:06 PM, Waiman Long wrote:
> The KMALLOC_NORMAL (kmalloc-<n>) caches are for unaccounted objects only
> when CONFIG_MEMCG_KMEM is enabled. To make sure that this condition
> remains true, we will have to prevent KMALOC_NORMAL caches to merge
> with other kmem caches. This is now done by setting its refcount to -1
> right after its creation.
>
> Suggested-by: Roman Gushchin <guro@...com>
> Signed-off-by: Waiman Long <longman@...hat.com>
Reviewed-by: Vlastimil Babka <vbabka@...e.cz>
(outside of scope of this patch/series, we should later replace this refcount
ugliness with a proper slab flag)
> ---
> mm/slab_common.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/mm/slab_common.c b/mm/slab_common.c
> index bbaf41a7c77e..a0ff8e1d8b67 100644
> --- a/mm/slab_common.c
> +++ b/mm/slab_common.c
> @@ -841,6 +841,13 @@ new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags)
> kmalloc_info[idx].name[type],
> kmalloc_info[idx].size, flags, 0,
> kmalloc_info[idx].size);
> +
> + /*
> + * If CONFIG_MEMCG_KMEM is enabled, disable cache merging for
> + * KMALLOC_NORMAL caches.
> + */
> + if (IS_ENABLED(CONFIG_MEMCG_KMEM) && (type == KMALLOC_NORMAL))
> + kmalloc_caches[type][idx]->refcount = -1;
> }
>
> /*
>
Powered by blists - more mailing lists