|
|
Log in / Subscribe / Register

improve the kmem_cache_alloc_bulk API

From:  Christoph Hellwig <hch-AT-lst.de>
To:  Vlastimil Babka <vbabka-AT-kernel.org>, Harry Yoo <harry-AT-kernel.org>, Andrew Morton <akpm-AT-linux-foundation.org>
Subject:  improve the kmem_cache_alloc_bulk API
Date:  Wed, 27 May 2026 09:02:21 +0200
Message-ID:  <20260527070239.2252948-1-hch@lst.de>
Cc:  Hao Li <hao.li-AT-linux.dev>, Christoph Lameter <cl-AT-gentwo.org>, David Rientjes <rientjes-AT-google.com>, Roman Gushchin <roman.gushchin-AT-linux.dev>, Jesper Dangaard Brouer <hawk-AT-kernel.org>, linux-arm-msm-AT-vger.kernel.org, dri-devel-AT-lists.freedesktop.org, freedreno-AT-lists.freedesktop.org, linux-kernel-AT-vger.kernel.org, linux-mm-AT-kvack.org, io-uring-AT-vger.kernel.org, kasan-dev-AT-googlegroups.com, bpf-AT-vger.kernel.org, netdev-AT-vger.kernel.org
Archive-link:  Article

Hi all,

kmem_cache_alloc_bulk has a very unintuitive and undocumented return
value convention.  Fix that and add documentation.

Note that the few comments explaining it mention that the gfp flags
must allow "spinning".  That's not really a term used in the memory
allocator, is this supposed to mean "block" or "sleep"?

Diffstat:
 drivers/gpu/drm/msm/msm_iommu.c       |    6 +--
 drivers/gpu/drm/panthor/panthor_mmu.c |   12 ++-----
 include/linux/slab.h                  |    6 ++-
 io_uring/io_uring.c                   |   23 +++++--------
 lib/test_meminit.c                    |   19 +++++------
 mm/kasan/kasan_test_c.c               |    5 +-
 mm/kfence/kfence_test.c               |    9 ++---
 mm/slub.c                             |   58 ++++++++++++++++++----------------
 net/bpf/test_run.c                    |    7 +---
 net/core/skbuff.c                     |   23 +++++++------
 tools/include/linux/slab.h            |    2 -
 tools/testing/shared/linux.c          |   19 ++++-------
 12 files changed, 92 insertions(+), 97 deletions(-)



Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds