From: Christoph Hellwig <hch@lst•de>
To: "Vlastimil Babka (SUSE)" <vbabka@kernel•org>
Cc: Christoph Hellwig <hch@lst•de>, Harry Yoo <harry@kernel•org>,
Andrew Morton <akpm@linux-foundation•org>,
Hao Li <hao.li@linux•dev>, Christoph Lameter <cl@gentwo•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,
linux-mm@kvack•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: Wed, 27 May 2026 14:20:13 +0200 [thread overview]
Message-ID: <20260527122013.GA6765@lst.de> (raw)
In-Reply-To: <f7f35169-f77d-4678-8797-a2ad00d89e6c@kernel.org>
On Wed, May 27, 2026 at 11:38:21AM +0200, Vlastimil Babka (SUSE) wrote:
> On 5/27/26 09:02, Christoph Hellwig wrote:
> > The kmem_cache_alloc_bulk return value is weird. It returns the number
> > of allocated objects, but that must always be 0 or the requested number
> > based on the implementations and the handling in the callers, but that
> > assumption is not actually documented anywhere, which confuses automated
> > review tools.
> >
> > Fix this by returning a bool if the allocation succeeded and adding a
> > kerneldoc comment explaining the API.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst•de>
>
> Would 0 / -ENOMEM be more like what people would expect? I guess both that
> and bool are better than the current API.
I find an errno return where the API could not return anything but the
specific error code a bit odd. But even that would be a lot better
than the current version.
next prev parent reply other threads:[~2026-05-27 12:20 UTC|newest]
Thread overview: 30+ 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 [this message]
2026-05-28 8:58 ` kernel test robot
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
2026-05-29 11:54 ` Vlastimil Babka (SUSE)
2026-05-29 13:50 ` Christoph Hellwig
2026-06-01 6:39 ` Harry Yoo
2026-06-01 8:16 ` Vlastimil Babka (SUSE)
2026-06-01 11:38 ` Christoph Hellwig
2026-06-01 12:50 ` Vlastimil Babka (SUSE)
2026-06-01 13:32 ` Rob Clark
2026-06-01 14:39 ` Rob Clark
2026-06-03 9:17 ` Vlastimil Babka (SUSE)
2026-06-03 11:13 ` Rob Clark
2026-06-03 16:22 ` Vlastimil Babka (SUSE)
2026-06-04 7:10 ` Harry Yoo
2026-06-04 7:35 ` Vlastimil Babka (SUSE)
2026-06-04 9:36 ` Rob Clark
2026-06-01 11:39 ` Harry Yoo
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=20260527122013.GA6765@lst.de \
--to=hch@lst$(echo .)de \
--cc=akpm@linux-foundation$(echo .)org \
--cc=bpf@vger$(echo .)kernel.org \
--cc=cl@gentwo$(echo .)org \
--cc=dri-devel@lists$(echo .)freedesktop.org \
--cc=freedreno@lists$(echo .)freedesktop.org \
--cc=hao.li@linux$(echo .)dev \
--cc=harry@kernel$(echo .)org \
--cc=hawk@kernel$(echo .)org \
--cc=io-uring@vger$(echo .)kernel.org \
--cc=kasan-dev@googlegroups$(echo .)com \
--cc=linux-arm-msm@vger$(echo .)kernel.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-mm@kvack$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=rientjes@google$(echo .)com \
--cc=roman.gushchin@linux$(echo .)dev \
--cc=vbabka@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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