From: Ziran Zhang <zhangcoder@yeah.net>
To: Gary Guo <gary@garyguo.net>
Cc: Will Deacon <will@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Boqun Feng <boqun@kernel.org>, Thomas Gleixner <tglx@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H . Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Mark Rutland <mark.rutland@arm.com>,
linux-kernel@vger.kernel.org, Ziran Zhang <zhangcoder@yeah.net>
Subject: Re: [PATCH] x86/atomic: Add arch_atomic_not()
Date: Wed, 15 Jul 2026 22:30:24 +0800 [thread overview]
Message-ID: <20260715143025.18489-1-zhangcoder@yeah.net> (raw)
In-Reply-To: <DJZ4E9495D1L.1X54VAWGPVYPT@garyguo.net>
On Wed, 15 Jul 2026 12:49:20 +0100, Gary Guo wrote:
> > The kernel already has non-atomic bitmap_complement(), but
> > no direct atomic implementation.
> >
> > According to Intel and AMD manuals, the NOT instruction
> > supports a LOCK prefix.
> >
> > Currently the only way to achieve this is arch_atomic_xor(-1, v),
> > which is non-obvious and hurts readability, so add arch_atomic_not()
> > to provide an explicit atomic complement operation.
>
> What do you need this for?
>
> Best,
> Gary
Hi Gary,
At present there is no code in kernel that would call
arch_atomic_not() or arch_atomic_xor(~0,v).
I'll drop this patch and revisit if a real use case
shows up in the future.
Thanks for the review!
Regards,
Ziran Zhang
prev parent reply other threads:[~2026-07-15 14:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 5:42 [PATCH] x86/atomic: Add arch_atomic_not() Ziran Zhang
2026-07-15 11:49 ` Gary Guo
2026-07-15 14:30 ` Ziran Zhang [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=20260715143025.18489-1-zhangcoder@yeah.net \
--to=zhangcoder@yeah.net \
--cc=boqun@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=gary@garyguo.net \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@kernel.org \
--cc=will@kernel.org \
--cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.