Skip to content

Commit 4ef9ad1

Browse files
Yang Shiakpm00
Yang Shi
authored andcommitted
mm: huge_memory: don't force huge page alignment on 32 bit
commit efa7df3 ("mm: align larger anonymous mappings on THP boundaries") caused two issues [1] [2] reported on 32 bit system or compat userspace. It doesn't make too much sense to force huge page alignment on 32 bit system due to the constrained virtual address space. [1] https://lore.kernel.org/linux-mm/[email protected]/ [2] https://lore.kernel.org/linux-mm/CAJuCfpHXLdQy1a2B6xN2d7quTYwg2OoZseYPZTRpU0eHHKD-sQ@mail.gmail.com/ Link: https://lkml.kernel.org/r/[email protected] Fixes: efa7df3 ("mm: align larger anonymous mappings on THP boundaries") Signed-off-by: Yang Shi <[email protected]> Reported-by: Jiri Slaby <[email protected]> Reported-by: Suren Baghdasaryan <[email protected]> Tested-by: Jiri Slaby <[email protected]> Tested-by: Suren Baghdasaryan <[email protected]> Reviewed-by: Matthew Wilcox (Oracle) <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Christopher Lameter <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 67695f1 commit 4ef9ad1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mm/huge_memory.c

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <linux/page_owner.h>
3838
#include <linux/sched/sysctl.h>
3939
#include <linux/memory-tiers.h>
40+
#include <linux/compat.h>
4041

4142
#include <asm/tlb.h>
4243
#include <asm/pgalloc.h>
@@ -811,6 +812,9 @@ static unsigned long __thp_get_unmapped_area(struct file *filp,
811812
loff_t off_align = round_up(off, size);
812813
unsigned long len_pad, ret;
813814

815+
if (IS_ENABLED(CONFIG_32BIT) || in_compat_syscall())
816+
return 0;
817+
814818
if (off_end <= off_align || (off_end - off_align) < size)
815819
return 0;
816820

0 commit comments

Comments
 (0)