Re: [PATCH] mm: huge_memory: don't force huge page alignment on 32 bit
From: Rik van Riel
Date: Fri Jan 19 2024 - 12:28:04 EST
On Thu, 2024-01-18 at 05:35 -0800, Yang Shi wrote:
> From: Yang Shi <yang@xxxxxxxxxxxxxxxxxxxxxx>
>
> The commit efa7df3e3bb5 ("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.
>
> +++ b/mm/huge_memory.c
>
> @@ -811,6 +812,14 @@ static unsigned long
> __thp_get_unmapped_area(struct file *filp,
> loff_t off_align = round_up(off, size);
> unsigned long len_pad, ret;
>
> + /*
> + * It doesn't make too much sense to froce huge page
> alignment on
> + * 32 bit system or compat userspace due to the contrained
> virtual
> + * address space and address entropy.
> + */
> + if (IS_ENABLED(CONFIG_32BIT) || in_compat_syscall())
> + return 0;
> +
> if (off_end <= off_align || (off_end - off_align) < size)
> return 0;
>
Reviewed-by: Rik van Riel <riel@xxxxxxxxxxx>
--
All Rights Reversed.