]> www.infradead.org Git - users/hch/block.git/commitdiff
mm: huge_memory: use !CONFIG_64BIT to relax huge page alignment on 32 bit machines
authorYang Shi <yang@os.amperecomputing.com>
Fri, 12 Jul 2024 15:58:55 +0000 (08:58 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 26 Jul 2024 21:33:09 +0000 (14:33 -0700)
Yves-Alexis Perez reported commit 4ef9ad19e176 ("mm: huge_memory: don't
force huge page alignment on 32 bit") didn't work for x86_32 [1].  It is
because x86_32 uses CONFIG_X86_32 instead of CONFIG_32BIT.

!CONFIG_64BIT should cover all 32 bit machines.

[1] https://lore.kernel.org/linux-mm/CAHbLzkr1LwH3pcTgM+aGQ31ip2bKqiqEQ8=FQB+t2c3dhNKNHA@mail.gmail.com/

Link: https://lkml.kernel.org/r/20240712155855.1130330-1-yang@os.amperecomputing.com
Fixes: 4ef9ad19e176 ("mm: huge_memory: don't force huge page alignment on 32 bit")
Signed-off-by: Yang Shi <yang@os.amperecomputing.com>
Reported-by: Yves-Alexis Perez <corsac@debian.org>
Tested-by: Yves-Alexis Perez <corsac@debian.org>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Christoph Lameter <cl@linux.com>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Salvatore Bonaccorso <carnil@debian.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: <stable@vger.kernel.org> [6.8+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/huge_memory.c

index f9696c94e2110b0ab957efae031f5bec1541ad18..04b72912035d9a8c6ebb97af0259ad8ae31dafd7 100644 (file)
@@ -877,7 +877,7 @@ static unsigned long __thp_get_unmapped_area(struct file *filp,
        loff_t off_align = round_up(off, size);
        unsigned long len_pad, ret, off_sub;
 
-       if (IS_ENABLED(CONFIG_32BIT) || in_compat_syscall())
+       if (!IS_ENABLED(CONFIG_64BIT) || in_compat_syscall())
                return 0;
 
        if (off_end <= off_align || (off_end - off_align) < size)