From: Karl Mehltretter <kmehltretter@gmail.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Alexei Starovoitov <ast@kernel.org>,
Alexander Duyck <alexanderduyck@fb.com>,
David Hildenbrand <david@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Brendan Jackman <brendan.jackman@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>,
Shakeel Butt <shakeel.butt@linux.dev>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] mm/page_alloc: skip shuffling and reporting for no-lock frees
Date: Wed, 21 Oct 2026 07:55:55 +0200 [thread overview]
Message-ID: <athTqt0vljgHb8q-@gmail.com> (raw)
In-Reply-To: <20261020110948.wv_yGAhQ@linutronix.de>
On Tue, Oct 20, 2026 at 01:09:48PM +0100, Sebastian Andrzej Siewior wrote:
> On 2026-10-20 12:02:01 [+0200], Vlastimil Babka (SUSE) wrote:
> > > An instrumented PREEMPT_RT lockdep run forced a random-bit cache refill
> > > while calling free_pages_nolock() under a raw spinlock. The unpatched
> > > allocator reported:
> > >
> > > BUG: Invalid wait context
> > >
> > > The attempted lock was batched_entropy_u64.lock in get_random_u64().
> > > Lockdep showed the raw test lock and zone->lock both held.
> >
> > In slab we solved this by using prandom - commit a1e244a9f177 ("mm/slab: use
> > prandom if !allow_spin")
> > Could be better?
>
> I hated it at first but now that I looked longer at it, it is not that
> bad.
>
For v2 I can pass allow_spin to shuffle_pick_tail(), keep the cached
get_random_u64() path for ordinary frees and use per-CPU prandom for
FPI_NOLOCK.
For page reporting, the issue is NMI rather than raw spinlocks in
general. free_pages_nolock() may be called from NMI, while the reporting
path may queue delayed work. I would keep the FPI_NOLOCK check and add a
comment explaining it.
I will also put is_shuffle_order() first as suggested.
Karl
prev parent reply other threads:[~2026-10-21 5:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 6:35 Karl Mehltretter
2026-10-20 10:02 ` Vlastimil Babka (SUSE)
2026-10-20 11:09 ` Sebastian Andrzej Siewior
2026-10-21 5:55 ` Karl Mehltretter [this message]
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=athTqt0vljgHb8q-@gmail.com \
--to=kmehltretter@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alexanderduyck@fb.com \
--cc=ast@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=brendan.jackman@linux.dev \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=shakeel.butt@linux.dev \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=ziy@nvidia.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
all inboxes | Powered by JetHome®