On Sat, Apr 05, 2025 at 06:09:11PM +0100, Sam James wrote: > Sam James <s...@gentoo.org> writes: > > > Lovely cleanup and a great suggestion from Al. > > > > Reviewed-by: Sam James <s...@gentoo.org> > > > > I'd suggest adding a: > > Suggested-by: Al Viro <v...@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-linm...@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 <linm...@gmail.com>