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/vmalloc: clarify why vmap_range_noflush() might sleep

The only reason vmap_range_noflush() can sleep is because of pagetable
allocations.

The actual allocation mechanism is arch-specific so might_alloc() doesn't
work here (what GFP flags would be used?). Hence, just add a comment.

Also note that this might do a TLB shootdown. This is not actually
sleeping but it requires IRQs on for x86, and might_sleep() incidentally
serves to detect violations of that too.

Link: https://lkml.kernel.org/r/20251215-b4-vmalloc-might_alloc-v3-1-92dd8e406868@google.com
Signed-off-by: Brendan Jackman <jackmanb@google.com>
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Brendan Jackman and committed by
Andrew Morton
a03ed8f1 6c790212

+5
+5
mm/vmalloc.c
··· 305 305 int err; 306 306 pgtbl_mod_mask mask = 0; 307 307 308 + /* 309 + * Might allocate pagetables (for most archs a more precise annotation 310 + * would be might_alloc(GFP_PGTABLE_KERNEL)). Also might shootdown TLB 311 + * (requires IRQs enabled on x86). 312 + */ 308 313 might_sleep(); 309 314 BUG_ON(addr >= end); 310 315