Re: [PATCH v2] arm64: raise default ARCH_MMAP_RND_BITS for 48-bit and 52-bit VA

From: Catalin Marinas

Date: Thu Oct 15 2026 - 12:35:31 EST


On Wed, Oct 14, 2026 at 10:23:35PM -0700, Iurii Trukhin wrote:
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index cab741a695f5..7bca47269dd5 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -313,6 +313,14 @@ config ARCH_MMAP_RND_BITS_MAX
> default 16 if ARM64_16K_PAGES
> default 18
>
> +# default to 1 TiB (5 bits below ARCH_MMAP_RND_BITS_MAX) on 48-bit and
> +# 52-bit VA; smaller VA sizes fall back to ARCH_MMAP_RND_BITS_MIN in
> +# arch/Kconfig
> +config ARCH_MMAP_RND_BITS
> + default 24 if (ARM64_VA_BITS=48 || ARM64_VA_BITS=52) && ARM64_64K_PAGES
> + default 26 if (ARM64_VA_BITS=48 || ARM64_VA_BITS=52) && ARM64_16K_PAGES
> + default 28 if (ARM64_VA_BITS=48 || ARM64_VA_BITS=52)

This looks fine but I was wondering what ARCH_MMAP_RND_BITS_DEFAULT (and
the compat equivalent) is for. It turns out that an int always evaluates
to 'n', so not taken into account. It might be worth removing them
altogether as a separate patch. No-one seems to be using them.

--
Catalin