diff options
| author | Brendan Jackman <jackmanb@google.com> | 2025-12-15 13:40:25 +0300 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-01-21 06:24:31 +0300 |
| commit | a03ed8f144e2732dbfce05d4ee5576d77aba6957 (patch) | |
| tree | 577003f756c31a3442f0bc35e68d0b600b10d313 | |
| parent | 6c790212c588fddeb0d852f2790840753bb604b1 (diff) | |
| download | linux-a03ed8f144e2732dbfce05d4ee5576d77aba6957.tar.xz | |
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>
| -rw-r--r-- | mm/vmalloc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 628f96e83b11..429a893b0505 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -305,6 +305,11 @@ static int vmap_range_noflush(unsigned long addr, unsigned long end, int err; pgtbl_mod_mask mask = 0; + /* + * Might allocate pagetables (for most archs a more precise annotation + * would be might_alloc(GFP_PGTABLE_KERNEL)). Also might shootdown TLB + * (requires IRQs enabled on x86). + */ might_sleep(); BUG_ON(addr >= end); |
