[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260106102120.4272260e@gandalf.local.home>
Date: Tue, 6 Jan 2026 10:21:20 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Andrew Morton <akpm@...ux-foundation.org>, Suren Baghdasaryan
<surenb@...gle.com>, Michal Hocko <mhocko@...e.com>, Brendan Jackman
<jackmanb@...gle.com>, Johannes Weiner <hannes@...xchg.org>, Zi Yan
<ziy@...dia.com>, Sebastian Andrzej Siewior <bigeasy@...utronix.de>, Clark
Williams <clrkwllms@...nel.org>, Mel Gorman <mgorman@...hsingularity.net>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
linux-rt-devel@...ts.linux.dev, stable@...r.kernel.org, kernel test robot
<oliver.sang@...el.com>, Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH mm-hotfixes] mm/page_alloc: prevent pcp corruption with
SMP=n
On Tue, 6 Jan 2026 09:28:29 +0100
Vlastimil Babka <vbabka@...e.cz> wrote:
> >> + */
> >> +#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)
> >> +static inline void __flags_noop(unsigned long *flags) { }
> >> +#define spin_lock_maybe_irqsave(lock, flags) \
> >> +({ \
> >> + __flags_noop(&(flags)); \
> >> + spin_lock(lock); \
> >> +})
> >> +#define spin_unlock_maybe_irqrestore(lock, flags) \
> >> +({ \
> >> + spin_unlock(lock); \
> >> + __flags_noop(&(flags)); \
> >> +})
> >> +#else
> >> +#define spin_lock_maybe_irqsave(lock, flags) spin_lock_irqsave(lock, flags)
> >> +#define spin_unlock_maybe_irqrestore(lock, flags) spin_unlock_irqrestore(lock, flags)
> >> +#endif
> >> +
> >
> > These are very generic looking names for something specific for
> > page_alloc.c. Could you add a prefix of some kind to make it easy to see
> > that these are specific to the mm code?
> >
> > mm_spin_lock_maybe_irqsave() ?
> OK, I think it's best like this:
Yeah, thanks.
-- Steve
>
> ----8<----
> >From a6da5d9e3db005a2f44f3196814d7253dce21d3e Mon Sep 17 00:00:00 2001
> From: Vlastimil Babka <vbabka@...e.cz>
> Date: Tue, 6 Jan 2026 09:23:37 +0100
> Subject: [PATCH] mm/page_alloc: prevent pcp corruption with SMP=n - fix
>
> Add pcp_ prefix to the spin_lock_irqsave wrappers, per Steven.
> With that make them also take pcp pointer and reference the lock
> field themselves, to be like the existing pcp trylock wrappers.
>
> Signed-off-by: Vlastimil Babka <vbabka@...e.cz>
> ---
> mm/page_alloc.c | 30 ++++++++++++++++--------------
> 1 file changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index ec3551d56cde..dd72ff39da8c 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -177,19 +177,21 @@ static inline void __pcp_trylock_noop(unsigned long *flags) { }
> */
> #if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)
> static inline void __flags_noop(unsigned long *flags) { }
> -#define spin_lock_maybe_irqsave(lock, flags) \
> +#define pcp_spin_lock_maybe_irqsave(ptr, flags) \
> ({ \
> __flags_noop(&(flags)); \
> - spin_lock(lock); \
> + spin_lock(&(ptr)->lock); \
> })
Powered by blists - more mailing lists