From: Christoph Hellwig <hch@lst.de>
To: Alexander Lobakin <aleksander.lobakin@intel.com>
Cc: Jesper Dangaard Brouer <hawk@kernel.org>,
Christoph Hellwig <hch@lst.de>,
Vlastimil Babka <vbabka@kernel.org>, 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>,
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, Matt Fleming <mfleming@cloudflare.com>,
kernel-team <kernel-team@cloudflare.com>
Subject: Re: [PATCH] mm/slab: improve kmem_cache_alloc_bulk
Date: Wed, 27 May 2026 16:07:24 +0200 [thread overview]
Message-ID: <20260527140724.GA13256@lst.de> (raw)
In-Reply-To: <777c7229-4285-4c7c-9340-dfaebd2ab291@intel.com>
On Wed, May 27, 2026 at 03:56:38PM +0200, Alexander Lobakin wrote:
> >> - n -= kmem_cache_alloc_bulk(net_hotdata.skbuff_cache,
> >> - GFP_ATOMIC | __GFP_ZERO | __GFP_NOWARN,
> >> - n - nc->skb_count, &skbs[nc->skb_count]);
> >> + if (kmem_cache_alloc_bulk(net_hotdata.skbuff_cache,
> >> + GFP_ATOMIC | __GFP_ZERO | __GFP_NOWARN,
> >> + n - nc->skb_count, &skbs[nc->skb_count]))
> >> + n = nc->skb_count;
>
> kmem_cache_alloc_bulk() allocates `n - nc->skb_count`, but here you
> assign `nc->skb_count` to n.
> Ah wait,
>
> n -= n - nc->skb_count
> n = n - (n - nc->skb_count)
> n = n - n + nc->skb_count
> n = nc->skb_count
>
> Correct :D
Exactly the steps I went through when writing this patch :)
next prev parent reply other threads:[~2026-05-27 14:07 UTC|newest]
Thread overview: 11+ 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 [this message]
2026-05-27 9:38 ` Vlastimil Babka (SUSE)
2026-05-27 12:20 ` Christoph Hellwig
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)
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=20260527140724.GA13256@lst.de \
--to=hch@lst.de \
--cc=akpm@linux-foundation.org \
--cc=aleksander.lobakin@intel.com \
--cc=bpf@vger.kernel.org \
--cc=cl@gentwo.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=io-uring@vger.kernel.org \
--cc=kasan-dev@googlegroups.com \
--cc=kernel-team@cloudflare.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mfleming@cloudflare.com \
--cc=netdev@vger.kernel.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