From: Harry Yoo <harry.yoo@oracle.com>
To: Vlastimil Babka <vbabka@suse.cz>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Harry Yoo <harry.yoo@oracle.com>,
Alexei Starovoitov <ast@kernel.org>, Hao Li <hao.li@linux.dev>,
linux-mm@kvack.org
Subject: [PATCH V2 0/2] fix lockdep warnings with kmalloc_nolock()
Date: Tue, 10 Feb 2026 17:18:58 +0900 [thread overview]
Message-ID: <20260210081900.329447-1-harry.yoo@oracle.com> (raw)
Hi, I've observed two lockdep warnings while testing
kmalloc_nolock() in NMI:
1. Accessing current->mems_allowed_seq seqlock in NMI isn't safe
and lockdep complains.
2. w/ CONFIG_SLAB_FREELIST_RANDOM, get_random_u32() acquires
a local_lock, which isn't safe in NMI and could cause a deadlock.
Let's fix them.
Note: This is based on the latest slab/for-next. It wasn't clear to me
if I should base it on slab/for-next or slab/for-next-fixes,
because the merge window has started, this series needs some exposure
in -next, and the patches in slab/for-next might land in mainline
in the meantime.
But the conflict resolution should be trivial even if it should have
been based on slab/for-next-fixes.
v1 -> v2:
- Patch 1: per Vlastimil's suggestion, do not access
current->mems_allowed_seq and avoid retry if !allow_spin,
rather than returning NULL.
v1: https://lore.kernel.org/linux-mm/20260206171348.35886-1-harry.yoo@oracle.com
Harry Yoo (2):
mm/slab: do not access current->mems_allowed_seq if !allow_spin
mm/slab: use prandom if !allow_spin
mm/slub.c | 41 +++++++++++++++++++++++++++++++++++------
1 file changed, 35 insertions(+), 6 deletions(-)
base-commit: f6ed7e47c1fc78e78c9bfeb668b1ad9ba5c58120
--
2.43.0
next reply other threads:[~2026-02-10 8:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-10 8:18 Harry Yoo [this message]
2026-02-10 8:18 ` [PATCH V2 1/2] mm/slab: do not access current->mems_allowed_seq if !allow_spin Harry Yoo
2026-02-10 8:19 ` [PATCH V2 2/2] mm/slab: use prandom " Harry Yoo
2026-02-10 9:58 ` [PATCH V2 0/2] fix lockdep warnings with kmalloc_nolock() Vlastimil Babka
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=20260210081900.329447-1-harry.yoo@oracle.com \
--to=harry.yoo@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=cl@gentwo.org \
--cc=hao.li@linux.dev \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=vbabka@suse.cz \
/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