Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: remove PMD alignment constraint in execmem_vmalloc()

When using vmalloc with VM_ALLOW_HUGE_VMAP flag, it will set the alignment
to PMD_SIZE internally, if it deems huge mappings to be eligible.
Therefore, setting the alignment in execmem_vmalloc is redundant. Apart
from this, it also reduces the probability of allocation in case vmalloc
fails to allocate hugepages - in the fallback case, vmalloc tries to use
the original alignment and allocate basepages, which unfortunately will
again be PMD_SIZE passed over from execmem_vmalloc, thus constraining the
search for a free space in vmalloc region.

Therefore, remove this constraint.

Link: https://lkml.kernel.org/r/20250918093453.75676-1-dev.jain@arm.com
Signed-off-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Dev Jain and committed by
Andrew Morton
4afb85f5 51032f26

-3
-3
mm/execmem.c
··· 38 38 if (kasan) 39 39 vm_flags |= VM_DEFER_KMEMLEAK; 40 40 41 - if (vm_flags & VM_ALLOW_HUGE_VMAP) 42 - align = PMD_SIZE; 43 - 44 41 p = __vmalloc_node_range(size, align, start, end, gfp_flags, 45 42 pgprot, vm_flags, NUMA_NO_NODE, 46 43 __builtin_return_address(0));