[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251208-b4-vmalloc-might_alloc-v1-1-94a9bb8ecb08@google.com>
Date: Mon, 08 Dec 2025 05:19:49 +0000
From: Brendan Jackman <jackmanb@...gle.com>
To: Andrew Morton <akpm@...ux-foundation.org>, Uladzislau Rezki <urezki@...il.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Brendan Jackman <jackmanb@...gle.com>
Subject: [PATCH] mm/vmalloc: clarify why vmap_range_noflush() might sleep
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@...gle.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@...gle.com>
Powered by blists - more mailing lists