mm/vmalloc: clarify why vmap_range_noflush() might sleep
Subsystems (2)
PATCH v2 1/1 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.
---
Changes in v2:
- Switched from might_alloc() to keeping might_sleep() + comment
- Link to v1: https://lore.kernel.org/r/[email protected]
--- mm/vmalloc.c | 1 + 1 file changed, 1 insertion(+)
mm/vmalloc.c +1 -0
@@ -305,6 +305,7 @@ static int vmap_range_noflush(unsigned long addr, unsigned long end,int err;pgtbl_mod_mask mask =0 ; +/* Might allocate pagetables. */ might_sleep ();BUG_ON (addr >= end);
---
base-commit: ecc46e02e0abe025a6e840cba2d647f23fd1d721
change-id: 20251208-b4-vmalloc-might_alloc-754a791e4e10
Best regards,
Signature · 1 line
Brendan Jackman <[email protected]>
Quoted 21 lines · Brendan Jackman
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.Signed-off-by Brendan Jackman <[email protected]>---
Changes in v2:
- Switched frommight_alloc()to keepingmight_sleep()+ comment
- Link to v1: https://lore.kernel.org/r/[email protected]--- mm/vmalloc.c | 1 + 1 file changed, 1 insertion(+)mm/vmalloc.c +0
-0
mm/vmalloc.c static int vmap_range_noflush(unsigned long addr, unsigned long end, · line 308
Quoted 4 lines
mm/vmalloc.c +1
-0@@ -305,6 +305,7 @@ static int vmap_range_noflush(unsigned long addr, unsigned long end,int err;pgtbl_mod_mask mask =0 ; +/* Might allocate pagetables. */
I just realised that for x86, there's also TLB shootdowns in pud_free_pmd_page() etc. So I guess this is also a might_ for the the lockdep_assert_irqs_enabled() in smp_call_function_many_cond(). Should probably mention that too.
Anything else I missed, before I send v3?
Quoted 2 lines
mm/vmalloc.c +0
-0might_sleep ();BUG_ON (addr >= end);