From: Al Viro <viro@zeniv.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linmag7@gmail.com, Al Viro <viro@ftp.linux.org.uk>,
arnd@arndb.de, chris@zankel.net, dinguyen@kernel.org,
glaubitz@physik.fu-berlin.de, ink@unseen.parts,
jcmvbkbc@gmail.com, kees@kernel.org, linux-alpha@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org,
linux-hexagon@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org,
linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org,
linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org,
linux-sh@vger.kernel.org, linux-snps-arc@lists.infradead.org,
linux-um@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,
loongarch@lists.linux.dev, mattst88@gmail.com, monstr@monstr.eu,
richard.henderson@linaro.org, sparclinux@vger.kernel.org,
x86@kernel.org, Sam James <sam@gentoo.org>
Subject: Re: [PATCH v2 1/1] mm: pgtable: fix pte_swp_exclusive
Date: Mon, 2 Jun 2025 05:11:18 +0100 [thread overview]
Message-ID: <20250602041118.GA2675383@ZenIV> (raw)
In-Reply-To: <87v7rik020.fsf@gentoo.org>
On Sat, Apr 05, 2025 at 06:09:11PM +0100, Sam James wrote:
> Sam James <sam@gentoo.org> writes:
>
> > Lovely cleanup and a great suggestion from Al.
> >
> > Reviewed-by: Sam James <sam@gentoo.org>
> >
> > I'd suggest adding a:
> > Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
>
> Al, were you planning on taking this through your tree?
FWIW, I expected it to get sent to Linus as "please, run this
sed script before -rc1" kind of thing, script being something
like
sed -i -e 's/int pte_swp_exclusive/bool pte_swp_exclusive/' \
`git grep -l 'int pte_swp_exclusive'`
with suggested commit message... It's absolutely regular and
that kind of tree-wide change is easier handled that way.
Oh, well... To restore the context: Magnus had spotted a fun
bug on Alpha back in February - pte_swp_exclusive() there returned
pte_val(pte) & _PAGE_SWP_EXCLUSIVE as int. The problem is that
_PAGE_SWP_EXCLUSIVE is 1UL<<39 there, with obvious results...
I looked at the originally posted patch and suggested to
make pte_swp_exclusive() return bool instead of int. All users
are in explicitly boolean contexts:
include/linux/swapops.h: if (pte_swp_exclusive(pte))
mm/debug_vm_pgtable.c: WARN_ON(pte_swp_exclusive(pte));
mm/debug_vm_pgtable.c: WARN_ON(!pte_swp_exclusive(pte));
mm/debug_vm_pgtable.c: WARN_ON(pte_swp_exclusive(pte));
mm/internal.h: if (pte_swp_exclusive(pte))
mm/memory.c: if (pte_swp_exclusive(orig_pte)) {
mm/memory.c: exclusive = pte_swp_exclusive(vmf->orig_pte);
mm/swapfile.c: if (pte_swp_exclusive(old_pte))
mm/userfaultfd.c: if (!pte_swp_exclusive(orig_src_pte)) {
Magnus posted patch of that form (see
https://lore.kernel.org/all/20250218175735.19882-2-linmag7@gmail.com/),
got no serious objections and then it went nowhere.
Bug is real and fairly obvious, fix is entirely mechanical and
affects one line in each asm/pgtable.h out there. Linus, could you
run that sed script just before -rc1? Commit message from the patch refered
above looks sane:
mm: pgtable: fix pte_swp_exclusive
Make pte_swp_exclusive return bool instead of int. This will better reflect
how pte_swp_exclusive is actually used in the code. This fixes swap/swapoff
problems on Alpha due pte_swp_exclusive not returning correct values when
_PAGE_SWP_EXCLUSIVE bit resides in upper 32-bits of PTE (like on alpha).
Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
next prev parent reply other threads:[~2025-06-02 4:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 17:55 [PATCH v2 0/1] mm: pgtable: fix pte_swp_exclusive Magnus Lindholm
2025-02-18 17:55 ` [PATCH v2 1/1] " Magnus Lindholm
2025-02-19 14:06 ` Sam James
2025-04-05 17:09 ` Sam James
2025-06-02 4:11 ` Al Viro [this message]
2025-06-02 15:16 ` Sam James
2025-04-05 17:21 ` John Paul Adrian Glaubitz
2025-04-07 8:06 ` Geert Uytterhoeven
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=20250602041118.GA2675383@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=arnd@arndb.de \
--cc=chris@zankel.net \
--cc=dinguyen@kernel.org \
--cc=glaubitz@physik.fu-berlin.de \
--cc=ink@unseen.parts \
--cc=jcmvbkbc@gmail.com \
--cc=kees@kernel.org \
--cc=linmag7@gmail.com \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-hexagon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-openrisc@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=linux-um@lists.infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=loongarch@lists.linux.dev \
--cc=mattst88@gmail.com \
--cc=monstr@monstr.eu \
--cc=richard.henderson@linaro.org \
--cc=sam@gentoo.org \
--cc=sparclinux@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@ftp.linux.org.uk \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).