From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
Minchan Kim <minchan@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: use unique zsmalloc caches names
Date: Fri, 6 Sep 2024 12:45:22 +0900 [thread overview]
Message-ID: <20240906034522.GA2413563@google.com> (raw)
In-Reply-To: <20240905145209.641c8f127ba353832a1be778@linux-foundation.org>
On (24/09/05 14:52), Andrew Morton wrote:
> > Each zsmalloc pool maintains several named kmem-caches for
> > zs_handle-s and zspage-s. On a system with multiple zsmalloc
> > pools and CONFIG_DEBUG_VM this triggers kmem_cache_sanity_check():
> >
> > kmem_cache of name 'zspage' already exists
> > WARNING: at mm/slab_common.c:108 do_kmem_cache_create_usercopy+0xb5/0x310
> > ...
> >
> > kmem_cache of name 'zs_handle' already exists
> > WARNING: at mm/slab_common.c:108 do_kmem_cache_create_usercopy+0xb5/0x310
> > ...
>
> This is old code. Did something recently change to trigger this warning?
The kmem_cache WARN_ON() seems to be a new thing 4c39529663b93
and I think for the past week or so my test box has been running
with DEBUG_VM disabled.
[..]
> > static int create_cache(struct zs_pool *pool)
> > {
> > - pool->handle_cachep = kmem_cache_create("zs_handle", ZS_HANDLE_SIZE,
> > - 0, 0, NULL);
> > + char name[32];
> > +
> > + snprintf(name, sizeof(name), "zs_handle-%s", pool->name);
>
> Always scary seeing code making such assumptions about it arguments in
> this fashion. Can we use kasprintf() and sleep well at night?
Sure, I'll switch to kasprintf() "pillow" in v2.
[..]
> > if (!pool->zspage_cachep) {
> > kmem_cache_destroy(pool->handle_cachep);
> > pool->handle_cachep = NULL;
>
> I guess we want to backport this into earlier kernels? If so, what
> would be a suitable Fixes:?
So this doesn't affect zsmalloc, it's only some user-space tools that
can get confused. The code in question has been around since forever.
The first kmem-cache has been introduced by 2e40e163a25a in 2015.
I'll add Fixes: 2e40e163a25af3 in v2, but I'm not certain if we are
in urge to backport anything.
prev parent reply other threads:[~2024-09-06 3:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 6:47 [PATCH] mm: use unique zsmalloc caches names Sergey Senozhatsky
2024-09-05 21:52 ` Andrew Morton
2024-09-06 3:45 ` Sergey Senozhatsky [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240906034522.GA2413563@google.com \
--to=senozhatsky@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.