linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/vmalloc: clarify why vmap_range_noflush() might sleep
@ 2025-12-08  5:19 Brendan Jackman
  2025-12-08  6:41 ` Anshuman Khandual
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Brendan Jackman @ 2025-12-08  5:19 UTC (permalink / raw)
  To: Andrew Morton, Uladzislau Rezki; +Cc: linux-mm, linux-kernel, Brendan Jackman

The only reason vmap_range_noflush() can sleep is because of pagetable
allocations. This might_sleep() is accurate, but we have a more
precise way to express this particular case, so help readers out by
using that.

Note that the actual GFP flags used to allocate here are arch-specific.
But as long as GFP_PGTABLE_KERNEL includes blockable flags, it should
serve as a reasonable common-denominator here.

This also ensures there is an fs_reclaim_acquire() even no pagetables
are actually allocated, which could potentially do a better job at
catching filesystem bugs.

---
Signed-off-by: Brendan Jackman <jackmanb@google.com>
---
 mm/vmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index a53c7462671bdd896f95712af71398ffbe22fb80..ff1876588b94ec69168324e93399dbd117a6959a 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -305,7 +305,7 @@ static int vmap_range_noflush(unsigned long addr, unsigned long end,
 	int err;
 	pgtbl_mod_mask mask = 0;
 
-	might_sleep();
+	might_alloc(GFP_PGTABLE_KERNEL);
 	BUG_ON(addr >= end);
 
 	start = addr;

---
base-commit: ecc46e02e0abe025a6e840cba2d647f23fd1d721
change-id: 20251208-b4-vmalloc-might_alloc-754a791e4e10

Best regards,
-- 
Brendan Jackman <jackmanb@google.com>



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-12-09  2:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-08  5:19 [PATCH] mm/vmalloc: clarify why vmap_range_noflush() might sleep Brendan Jackman
2025-12-08  6:41 ` Anshuman Khandual
2025-12-08  7:39   ` Brendan Jackman
2025-12-08 17:32     ` Uladzislau Rezki
2025-12-08  8:51 ` [syzbot ci] " syzbot ci
2025-12-09  2:56   ` Brendan Jackman
2025-12-09  1:10 ` [PATCH] " kernel test robot
2025-12-09  1:52 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox