From: Sang-Heon Jeon <ekffu200098@gmail.com>
To: Vlastimil Babka <vbabka@kernel.org>, Harry Yoo <harry@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>, Hao Li <hao.li@linux.dev>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Roman Gushchin <roman.gushchin@linux.dev>
Subject: [PATCH 2/3] mm/slub: use kmem_cache_alloc() in bootstrap()
Date: Wed, 2 Dec 2026 01:52:50 +0900 [thread overview]
Message-ID: <20261201165256.1286791-3-ekffu200098@gmail.com> (raw)
In-Reply-To: <20261201165256.1286791-1-ekffu200098@gmail.com>
bootstrap() allocates a kmem_cache with kmem_cache_zalloc(), which
returns zero-initialized memory. memcpy() then overwrites the whole
object, and nothing uses it in between.
So allocate it with kmem_cache_alloc() instead.
No functional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
mm/slub.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/slub.c b/mm/slub.c
index e966a0de1515..8e6e900fc39b 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -8671,7 +8671,7 @@ static int slab_memory_callback(struct notifier_block *self,
static struct kmem_cache * __init bootstrap(struct kmem_cache *static_cache)
{
int node;
- struct kmem_cache *s = kmem_cache_zalloc(kmem_cache, GFP_NOWAIT);
+ struct kmem_cache *s = kmem_cache_alloc(kmem_cache, GFP_NOWAIT);
struct kmem_cache_node *n;
memcpy(s, static_cache, kmem_cache->object_size);
--
2.53.0
next prev parent reply other threads:[~2026-12-01 16:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 16:52 [PATCH 0/3] mm/slub: two small cleanups and a small fix Sang-Heon Jeon
2026-12-01 16:52 ` [PATCH 1/3] mm/slub: remove always-true check in calculate_sizes() Sang-Heon Jeon
2026-12-01 16:52 ` Sang-Heon Jeon [this message]
2026-12-01 16:52 ` [PATCH 3/3] mm/slub: copy only the requested size in kvrealloc() Sang-Heon Jeon
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=20261201165256.1286791-3-ekffu200098@gmail.com \
--to=ekffu200098@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=vbabka@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox