From: kernel test robot <lkp@intel.com>
To: Christoph Hellwig <hch@lst.de>,
Vlastimil Babka <vbabka@kernel.org>, Harry Yoo <harry@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>,
Hao Li <hao.li@linux.dev>,
Christoph Lameter <cl@linux-foundation.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Jesper Dangaard Brouer <hawk@kernel.org>,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org,
io-uring@vger.kernel.org, kasan-dev@googlegroups.com,
bpf@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] mm/slab: improve kmem_cache_alloc_bulk
Date: Thu, 28 May 2026 16:58:24 +0800 [thread overview]
Message-ID: <202605281629.y8HhAihO-lkp@intel.com> (raw)
In-Reply-To: <20260527070239.2252948-2-hch@lst.de>
Hi Christoph,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Christoph-Hellwig/mm-slab-improve-kmem_cache_alloc_bulk/20260527-150421
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20260527070239.2252948-2-hch%40lst.de
patch subject: [PATCH] mm/slab: improve kmem_cache_alloc_bulk
config: parisc-randconfig-r071-20260528 (https://download.01.org/0day-ci/archive/20260528/202605281629.y8HhAihO-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 8.5.0
smatch: v0.5.0-9185-gbcc58b9c
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260528/202605281629.y8HhAihO-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605281629.y8HhAihO-lkp@intel.com/
All errors (new ones prefixed by >>):
lib/test_meminit.c: In function 'do_kmem_cache_size':
>> lib/test_meminit.c:239:29: error: 'ret' undeclared (first use in this function); did you mean 'net'?
kmem_cache_free_bulk(c, ret, bulk_array);
^~~
net
lib/test_meminit.c:239:29: note: each undeclared identifier is reported only once for each function it appears in
vim +239 lib/test_meminit.c
dc5c5ad79f0cc2d Laura Abbott 2019-12-04 209
5015a300a522c8f Alexander Potapenko 2019-07-16 210 /*
5015a300a522c8f Alexander Potapenko 2019-07-16 211 * Test kmem_cache with given parameters:
5015a300a522c8f Alexander Potapenko 2019-07-16 212 * want_ctor - use a constructor;
5015a300a522c8f Alexander Potapenko 2019-07-16 213 * want_rcu - use SLAB_TYPESAFE_BY_RCU;
5015a300a522c8f Alexander Potapenko 2019-07-16 214 * want_zero - use __GFP_ZERO.
5015a300a522c8f Alexander Potapenko 2019-07-16 215 */
5015a300a522c8f Alexander Potapenko 2019-07-16 216 static int __init do_kmem_cache_size(size_t size, bool want_ctor,
5015a300a522c8f Alexander Potapenko 2019-07-16 217 bool want_rcu, bool want_zero,
5015a300a522c8f Alexander Potapenko 2019-07-16 218 int *total_failures)
5015a300a522c8f Alexander Potapenko 2019-07-16 219 {
5015a300a522c8f Alexander Potapenko 2019-07-16 220 struct kmem_cache *c;
5015a300a522c8f Alexander Potapenko 2019-07-16 221 int iter;
5015a300a522c8f Alexander Potapenko 2019-07-16 222 bool fail = false;
5015a300a522c8f Alexander Potapenko 2019-07-16 223 gfp_t alloc_mask = GFP_KERNEL | (want_zero ? __GFP_ZERO : 0);
5015a300a522c8f Alexander Potapenko 2019-07-16 224 void *buf, *buf_copy;
5015a300a522c8f Alexander Potapenko 2019-07-16 225
5015a300a522c8f Alexander Potapenko 2019-07-16 226 c = kmem_cache_create("test_cache", size, 1,
5015a300a522c8f Alexander Potapenko 2019-07-16 227 want_rcu ? SLAB_TYPESAFE_BY_RCU : 0,
5015a300a522c8f Alexander Potapenko 2019-07-16 228 want_ctor ? test_ctor : NULL);
5015a300a522c8f Alexander Potapenko 2019-07-16 229 for (iter = 0; iter < 10; iter++) {
dc5c5ad79f0cc2d Laura Abbott 2019-12-04 230 /* Do a test of bulk allocations */
dc5c5ad79f0cc2d Laura Abbott 2019-12-04 231 if (!want_rcu && !want_ctor) {
863d4ee245fb4d6 Christoph Hellwig 2026-05-27 232 if (!kmem_cache_alloc_bulk(c, alloc_mask, BULK_SIZE,
863d4ee245fb4d6 Christoph Hellwig 2026-05-27 233 bulk_array)) {
dc5c5ad79f0cc2d Laura Abbott 2019-12-04 234 fail = true;
dc5c5ad79f0cc2d Laura Abbott 2019-12-04 235 } else {
dc5c5ad79f0cc2d Laura Abbott 2019-12-04 236 int i;
863d4ee245fb4d6 Christoph Hellwig 2026-05-27 237 for (i = 0; i < BULK_SIZE; i++)
dc5c5ad79f0cc2d Laura Abbott 2019-12-04 238 fail |= check_buf(bulk_array[i], size, want_ctor, want_rcu, want_zero);
dc5c5ad79f0cc2d Laura Abbott 2019-12-04 @239 kmem_cache_free_bulk(c, ret, bulk_array);
dc5c5ad79f0cc2d Laura Abbott 2019-12-04 240 }
dc5c5ad79f0cc2d Laura Abbott 2019-12-04 241 }
dc5c5ad79f0cc2d Laura Abbott 2019-12-04 242
5015a300a522c8f Alexander Potapenko 2019-07-16 243 buf = kmem_cache_alloc(c, alloc_mask);
5015a300a522c8f Alexander Potapenko 2019-07-16 244 /* Check that buf is zeroed, if it must be. */
dc5c5ad79f0cc2d Laura Abbott 2019-12-04 245 fail |= check_buf(buf, size, want_ctor, want_rcu, want_zero);
5015a300a522c8f Alexander Potapenko 2019-07-16 246 fill_with_garbage_skip(buf, size, want_ctor ? CTOR_BYTES : 0);
d3a811617ae629d Arnd Bergmann 2019-07-16 247
d3a811617ae629d Arnd Bergmann 2019-07-16 248 if (!want_rcu) {
d3a811617ae629d Arnd Bergmann 2019-07-16 249 kmem_cache_free(c, buf);
d3a811617ae629d Arnd Bergmann 2019-07-16 250 continue;
d3a811617ae629d Arnd Bergmann 2019-07-16 251 }
d3a811617ae629d Arnd Bergmann 2019-07-16 252
5015a300a522c8f Alexander Potapenko 2019-07-16 253 /*
5015a300a522c8f Alexander Potapenko 2019-07-16 254 * If this is an RCU cache, use a critical section to ensure we
5015a300a522c8f Alexander Potapenko 2019-07-16 255 * can touch objects after they're freed.
5015a300a522c8f Alexander Potapenko 2019-07-16 256 */
5015a300a522c8f Alexander Potapenko 2019-07-16 257 rcu_read_lock();
5015a300a522c8f Alexander Potapenko 2019-07-16 258 /*
5015a300a522c8f Alexander Potapenko 2019-07-16 259 * Copy the buffer to check that it's not wiped on
5015a300a522c8f Alexander Potapenko 2019-07-16 260 * free().
5015a300a522c8f Alexander Potapenko 2019-07-16 261 */
733d1d1a7745113 Alexander Potapenko 2019-08-02 262 buf_copy = kmalloc(size, GFP_ATOMIC);
5015a300a522c8f Alexander Potapenko 2019-07-16 263 if (buf_copy)
5015a300a522c8f Alexander Potapenko 2019-07-16 264 memcpy(buf_copy, buf, size);
d3a811617ae629d Arnd Bergmann 2019-07-16 265
4ab7ace465466d2 Alexander Potapenko 2019-07-16 266 kmem_cache_free(c, buf);
5015a300a522c8f Alexander Potapenko 2019-07-16 267 /*
5015a300a522c8f Alexander Potapenko 2019-07-16 268 * Check that |buf| is intact after kmem_cache_free().
5015a300a522c8f Alexander Potapenko 2019-07-16 269 * |want_zero| is false, because we wrote garbage to
5015a300a522c8f Alexander Potapenko 2019-07-16 270 * the buffer already.
5015a300a522c8f Alexander Potapenko 2019-07-16 271 */
5015a300a522c8f Alexander Potapenko 2019-07-16 272 fail |= check_buf(buf, size, want_ctor, want_rcu,
5015a300a522c8f Alexander Potapenko 2019-07-16 273 false);
5015a300a522c8f Alexander Potapenko 2019-07-16 274 if (buf_copy) {
5015a300a522c8f Alexander Potapenko 2019-07-16 275 fail |= (bool)memcmp(buf, buf_copy, size);
5015a300a522c8f Alexander Potapenko 2019-07-16 276 kfree(buf_copy);
5015a300a522c8f Alexander Potapenko 2019-07-16 277 }
5015a300a522c8f Alexander Potapenko 2019-07-16 278 rcu_read_unlock();
5015a300a522c8f Alexander Potapenko 2019-07-16 279 }
5015a300a522c8f Alexander Potapenko 2019-07-16 280 kmem_cache_destroy(c);
5015a300a522c8f Alexander Potapenko 2019-07-16 281
5015a300a522c8f Alexander Potapenko 2019-07-16 282 *total_failures += fail;
5015a300a522c8f Alexander Potapenko 2019-07-16 283 return 1;
5015a300a522c8f Alexander Potapenko 2019-07-16 284 }
5015a300a522c8f Alexander Potapenko 2019-07-16 285
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2026-05-28 8:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 7:02 improve the kmem_cache_alloc_bulk API Christoph Hellwig
2026-05-27 7:02 ` [PATCH] mm/slab: improve kmem_cache_alloc_bulk Christoph Hellwig
2026-05-27 7:53 ` bot+bpf-ci
2026-05-27 8:51 ` Jesper Dangaard Brouer
2026-05-27 13:56 ` Alexander Lobakin
2026-05-27 14:07 ` Christoph Hellwig
2026-05-27 9:38 ` Vlastimil Babka (SUSE)
2026-05-27 12:20 ` Christoph Hellwig
2026-05-28 8:58 ` kernel test robot [this message]
2026-05-27 9:11 ` improve the kmem_cache_alloc_bulk API Vlastimil Babka (SUSE)
2026-05-27 12:21 ` Christoph Hellwig
2026-05-27 14:07 ` Vlastimil Babka (SUSE)
2026-05-28 9:05 ` Christoph Hellwig
2026-05-28 9:16 ` Vlastimil Babka (SUSE)
-- strict thread matches above, loose matches on Subject: below --
2026-05-28 9:34 improve the kmem_cache_alloc_bulk API v2 Christoph Hellwig
2026-05-28 9:34 ` [PATCH] mm/slab: improve kmem_cache_alloc_bulk Christoph Hellwig
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=202605281629.y8HhAihO-lkp@intel.com \
--to=lkp@intel.com \
--cc=akpm@linux-foundation.org \
--cc=bpf@vger.kernel.org \
--cc=cl@linux-foundation.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=hawk@kernel.org \
--cc=hch@lst.de \
--cc=io-uring@vger.kernel.org \
--cc=kasan-dev@googlegroups.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--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