Skip to content

Commit f101c56

Browse files
korneldulebawilldeacon
authored andcommitted
arm64: Support ARM64_VA_BITS=52 when setting ARCH_MMAP_RND_BITS_MAX
When the 52-bit virtual addressing was introduced the select like ARCH_MMAP_RND_BITS_MAX logic was never updated to account for it. Because of that the rnd max bits knob is set to the default value of 18 when ARM64_VA_BITS=52. Fix this by setting ARCH_MMAP_RND_BITS_MAX to the same value that would be used if 48-bit addressing was used. Higher values can't used here because 52-bit addressing is used only if the caller provides a hint to mmap, with a fallback to 48-bit. The knob in question is an upper bound for what the user can set in /proc/sys/vm/mmap_rnd_bits, which in turn is used to determine how many random bits can be inserted into the base address used for mmap allocations. Since 48-bit allocations are legal with ARM64_VA_BITS=52, we need to make sure that the base address is small enough to facilitate this. Fixes: b6d00d4 ("arm64: mm: Introduce 52-bit Kernel VAs") Signed-off-by: Kornel Dulęba <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 1db780b commit f101c56

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/arm64/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ config ARCH_MMAP_RND_BITS_MAX
333333
default 24 if ARM64_VA_BITS=39
334334
default 27 if ARM64_VA_BITS=42
335335
default 30 if ARM64_VA_BITS=47
336-
default 29 if ARM64_VA_BITS=48 && ARM64_64K_PAGES
337-
default 31 if ARM64_VA_BITS=48 && ARM64_16K_PAGES
338-
default 33 if ARM64_VA_BITS=48
336+
default 29 if (ARM64_VA_BITS=48 || ARM64_VA_BITS=52) && ARM64_64K_PAGES
337+
default 31 if (ARM64_VA_BITS=48 || ARM64_VA_BITS=52) && ARM64_16K_PAGES
338+
default 33 if (ARM64_VA_BITS=48 || ARM64_VA_BITS=52)
339339
default 14 if ARM64_64K_PAGES
340340
default 16 if ARM64_16K_PAGES
341341
default 18

0 commit comments

Comments
 (0)