From: sashiko-bot@kernel.org
To: "Herbert Xu" <herbert@gondor.apana.org.au>,
"Uladzislau Rezki" <urezki@gmail.com>
Cc: "Linus Torvalds" <torvalds@linux-foundation.org>,
"Liam R. Howlett (Google)" <liam@infradead.org>,
"Davidlohr Bueso" <dave@stgolabs.net>,
"Michal Hocko" <mhocko@suse.com>,
"Baoquan He" <baoquan.he@linux.dev>,
"Alexander Potapenko" <glider@google.com>,
"Andrey Ryabinin" <ryabinin.a.a@gmail.com>,
"Marco Elver" <elver@google.com>,
"Michal Hocko" <mhocko@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Thomas Graf" <tgraf@suug.ch>,
linux-mm@kvack.org, "Lorenzo Stoakes" <ljs@kernel.org>,
"Chris Mason" <mason@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Andrew Ballance" <andrewjballance@gmail.com>,
"David Hildenbrand (Arm)" <david@kernel.org>
Subject: Re: [PATCH] mm: kvmalloc: Bail if called with soft or hard IRQs disabled
Date: Sat, 14 Nov 2026 13:03:25 +0000 [thread overview]
Message-ID: <sashiko-outbox-214521@kernel.org> (raw)
In-Reply-To: <avcKfEvln8_2a7fJ@gondor.apana.org.au>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mm: kvmalloc: commit message mismatch and deprecated
in_interrupt() use
--
commit bac4fc34f0010889bd9f7724714bf23ec9386ed9
Author: Herbert Xu <herbert@gondor.apana.org.au>
> mm: kvmalloc: Bail if called with soft or hard IRQs disabled
>
> On Thu, Nov 05, 2026 at 06:37:49PM +0100, Uladzislau Rezki wrote:
> >
> > Probably the simplest option is to return NULL for non-blocking vmalloc()
> > allocations when BH are disabled. That would address the reported
> > rhashtable deadlock.
>
> OK let's try this patch:
>
> ---8<---
> The function kvmalloc may call vmalloc under the hood even when
> used with GFP_ATOMIC. However, vmalloc uses naked spin locks so
> it must not be called if the caller already holds spin locks that
> can be used in hard or soft IRQ context.
>
> Use the heuristic irqs_disabled() || in_softirq() to detect such
> callers and prevent them from using vmalloc.
>
> Reported-by: Liam R. Howlett (Google) <liam@infradead.org>
> Fixes: c6307674ed82 ("mm: kvmalloc: add non-blocking support for vmalloc")
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/mm/slub.c b/mm/slub.c
> index a151268b97263..5965d69926154 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -7148,6 +7148,14 @@ void *__kvmalloc_node_noprof(DECL_KMALLOC_PARAMS(size, b, token), unsigned long
> if (ret || size <= PAGE_SIZE)
> return ret;
>
> + /*
> + * vmalloc uses naked spin locks, so it must not be used if
> + * the caller already holds a spin lock that can be used in
> + * a soft or hard IRQ. Use heuristics to detect this.
> + */
> + if (irqs_disabled() || in_interrupt())
> + return NULL;
[Severity: Low]
The commit message says this uses irqs_disabled() || in_softirq(), whereas
__kvmalloc_node_noprof() calls in_interrupt(). Note that both in_softirq()
and in_interrupt() are marked deprecated in include/linux/preempt.h and
documented as not to be used in new code. Also, the commit message still
contains the unstripped email reply preamble and "---8<---" scissors line.
--
Sashiko AI review · https://sashiko.dev/#/patchset/avcKfEvln8_2a7fJ@gondor.apana.org.au?part=1
next prev parent reply other threads:[~2026-11-14 13:03 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 15:42 [PATCH 0/4] Lib fixes for 7.3 Liam R. Howlett (Google)
2026-10-28 15:42 ` [PATCH 1/4] maple_tree: Fix rcu reader NULL dereference after the tree is emptied Liam R. Howlett (Google)
2026-10-28 15:42 ` [PATCH 2/4] maple_tree: Test emptying tree while RCU reading Liam R. Howlett (Google)
2026-10-28 15:42 ` [PATCH 3/4] maple_tree: Update internal warning and bug_on code Liam R. Howlett (Google)
2026-10-28 17:54 ` Lorenzo Stoakes (ARM)
2026-10-28 18:37 ` Liam R. Howlett (Google)
2026-10-28 15:42 ` [PATCH 4/4] rhashtable: fix vmalloc() deadlock in atomic rehash Liam R. Howlett (Google)
2026-10-29 2:16 ` Herbert Xu
2026-10-29 10:08 ` Uladzislau Rezki
2026-10-29 14:53 ` Liam R. Howlett (Google)
2026-10-29 16:23 ` Michal Hocko
2026-10-30 4:48 ` Herbert Xu
2026-10-30 9:52 ` Uladzislau Rezki
2026-10-30 19:11 ` Matthew Wilcox
2026-11-02 11:18 ` Uladzislau Rezki
2026-10-31 0:56 ` Liam R. Howlett (Google)
2026-11-01 0:19 ` Herbert Xu
2026-11-03 1:49 ` Liam R. Howlett (Google)
2026-11-04 3:58 ` Herbert Xu
2026-11-04 4:28 ` Linus Torvalds
2026-11-04 5:21 ` Herbert Xu
2026-11-04 5:39 ` Linus Torvalds
2026-11-04 5:57 ` Herbert Xu
2026-11-04 11:11 ` Uladzislau Rezki
2026-11-05 8:51 ` Herbert Xu
2026-11-05 16:22 ` Linus Torvalds
2026-11-05 17:37 ` Uladzislau Rezki
2026-11-13 13:02 ` [PATCH] mm: kvmalloc: Bail if called with soft or hard IRQs disabled Herbert Xu
2026-11-13 17:47 ` Linus Torvalds
2026-11-14 0:35 ` Herbert Xu
2026-11-14 2:19 ` Linus Torvalds
2026-11-14 13:03 ` sashiko-bot [this message]
2026-11-05 18:44 ` [PATCH 4/4] rhashtable: fix vmalloc() deadlock in atomic rehash Uladzislau Rezki
2026-11-05 21:02 ` Linus Torvalds
2026-11-06 5:49 ` Herbert Xu
2026-11-06 14:43 ` Uladzislau Rezki
2026-10-29 20:02 ` Matthew Wilcox
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=sashiko-outbox-214521@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=aliceryhl@google.com \
--cc=andrewjballance@gmail.com \
--cc=baoquan.he@linux.dev \
--cc=dave@stgolabs.net \
--cc=david@kernel.org \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=liam@infradead.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mason@kernel.org \
--cc=mhocko@kernel.org \
--cc=mhocko@suse.com \
--cc=ryabinin.a.a@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tgraf@suug.ch \
--cc=torvalds@linux-foundation.org \
--cc=urezki@gmail.com \
/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