All of lore.kernel.org
 help / color / mirror / Atom feed
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 1/3] mm/slub: remove always-true check in calculate_sizes()
Date: Wed,  2 Dec 2026 01:52:49 +0900	[thread overview]
Message-ID: <20261201165256.1286791-2-ekffu200098@gmail.com> (raw)
In-Reply-To: <20261201165256.1286791-1-ekffu200098@gmail.com>

When calculate_order() succeeds, a slab of the returned order holds at
least one and at most MAX_OBJS_PER_PAGE objects, so oo_objects(s->oo)
is never zero.

So remove the check and return 1 explicitly.

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 47a664427c50..e966a0de1515 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -8233,7 +8233,7 @@ static int calculate_sizes(struct kmem_cache_args *args, struct kmem_cache *s)
 	s->oo = oo_make(order, size);
 	s->min = oo_make(get_order(size), size);
 
-	return !!oo_objects(s->oo);
+	return 1;
 }
 
 static void list_slab_objects(struct kmem_cache *s, struct slab *slab)
-- 
2.53.0


  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 ` Sang-Heon Jeon [this message]
2026-12-01 16:52 ` [PATCH 2/3] mm/slub: use kmem_cache_alloc() in bootstrap() Sang-Heon Jeon
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-2-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 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.