[PATCH 5/5] mm: Do not map the shadow stack as THP

David Hildenbrand (Arm) david at kernel.org
Wed Feb 25 05:34:44 PST 2026


On 2/24/26 18:57, Catalin Marinas wrote:
> The default shadow stack size allocated on first prctl() for the main
> thread or subsequently on clone() is either half of RLIMIT_STACK or half
> of a thread's stack size (for arm64). Both of these are likely to be
> suitable for a THP allocation and the kernel is more aggressive in
> creating such mappings. However, it does not make much sense to use a
> huge page. It didn't make sense for the normal stacks either, see commit
> c4608d1bf7c6 ("mm: mmap: map MAP_STACK to VM_NOHUGEPAGE").
> 
> Force VM_NOHUGEPAGE when allocating/mapping the shadow stack. As per
> commit 7190b3c8bd2b ("mm: mmap: map MAP_STACK to VM_NOHUGEPAGE only if
> THP is enabled"), only pass this flag if TRANSPARENT_HUGEPAGE is enabled
> as not to confuse CRIU tools.
> 
> Signed-off-by: Catalin Marinas <catalin.marinas at arm.com>
> Cc: Andrew Morton <akpm at linux-foundation.org>
> Cc: David Hildenbrand <david at kernel.org>
> ---

Acked-by: David Hildenbrand (Arm) <david at kernel.org>

-- 
Cheers,

David



More information about the linux-arm-kernel mailing list