Subject: Re: [PATCH] arm64: remove HAVE_CMPXCHG_LOCAL

From: Jisheng Zhang <[email-masked]>
Date: Fri, 20 Feb 2026 14:20:54 +0800

On Wed, Feb 18, 2026 at 02:07:57PM -0800, Shakeel Butt wrote:
> On Sun, Feb 15, 2026 at 11:39:44AM +0800, Jisheng Zhang wrote:
> > It turns out the generic disable/enable irq this_cpu_cmpxchg
> > implementation is faster than LL/SC or lse implementation. Remove
> > HAVE_CMPXCHG_LOCAL for better performance on arm64.
> > 
> > Tested on Quad 1.9GHZ CA55 platform:
> > average mod_node_page_state() cost decreases from 167ns to 103ns
> > the spawn (30 duration) benchmark in unixbench is improved
> > from 147494 lps to 150561 lps, improved by 2.1%
> > 
> > Tested on Quad 2.1GHZ CA73 platform:
> > average mod_node_page_state() cost decreases from 113ns to 85ns
> > the spawn (30 duration) benchmark in unixbench is improved
> > from 209844 lps to 212581 lps, improved by 1.3%
> > 
> > Signed-off-by: Jisheng Zhang <[email-masked]>
> 
> Please note that mod_node_page_state() can be called in NMI context and
> generic disable/enable irq are not safe against NMIs (newer arm arch supports
> NMI).

hmm, interesting...

fgrep HAVE_NMI arch/*/Kconfig
then
fgrep HAVE_CMPXCHG_LOCAL arch/*/Kconfig

shows that only x86, arm64, s390 and loongarch are safe, while arm,
powerpc and mips enable HAVE_NMI but missing HAVE_CMPXCHG_LOCAL, so
they rely on generic generic disable/enable irq version, so you imply
that these three arch are not safe considering mod_node_page_state()
in NMI context.