From: Linus Torvalds <torvalds@linux-foundation.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Waiman Long <longman@redhat.com>,
Mel Gorman <mgorman@techsingularity.net>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [RFC] making nested spin_trylock() work on UP?
Date: Sat, 14 Feb 2026 08:32:55 -0800 [thread overview]
Message-ID: <CAHk-=wg9F6iW8wuH8bCDFRJyFCdtin5bXJW5v4WjNyynD7eoCA@mail.gmail.com> (raw)
In-Reply-To: <aZAWGwZP_Z75YHKt@casper.infradead.org>
On Fri, 13 Feb 2026 at 22:29, Matthew Wilcox <willy@infradead.org> wrote:
>
> What if we use an atomic_t on UP to simulate there being a spinlock,
> but only for pcp?
Yes. Please just wrap this - very unusual - use case with a special
wrapper that can then be entirely different for UP and SMP, and use
something like the suggested "pcp_lock" that becomes a spinlock on
smp, and just a tracking variable on UP.
And I don't think it needs to even be marked as 'atomic_t' on UP - the
value is going to be idempotent even when modified from interrupts
(because it will just be modified back), so no need for any special
logic, I think. The generic 'atomic_t' ops on UP disable interrupts,
which is horrendous.
Changing spinlocks globally on UP to be something they haven't been
before does not sound like a good idea, particularly since no actual
developer uses UP any more (and honestly, UP is dead outside of very
low-end platforms or legacy like 68k).
Linus
next prev parent reply other threads:[~2026-02-14 16:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 11:57 Vlastimil Babka
2026-02-14 6:28 ` Matthew Wilcox
2026-02-14 16:32 ` Linus Torvalds [this message]
2026-02-16 10:32 ` Vlastimil Babka
-- strict thread matches above, loose matches on Subject: below --
2026-02-13 11:57 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='CAHk-=wg9F6iW8wuH8bCDFRJyFCdtin5bXJW5v4WjNyynD7eoCA@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=longman@redhat.com \
--cc=mgorman@techsingularity.net \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vbabka@suse.cz \
--cc=will@kernel.org \
--cc=willy@infradead.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