Skip to contentSkip to conversation

mm-kasan-support-non-blocking-gfp-in-kasan_populate_vmalloc.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Nov 17, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/kasan: support non-blocking GFP in kasan_populate_vmalloc()
has been removed from the -mm tree. Its filename was
mm-kasan-support-non-blocking-gfp-in-kasan_populate_vmalloc.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: "Uladzislau Rezki (Sony)" <[email protected]>
Subject: mm/kasan: support non-blocking GFP in kasan_populate_vmalloc()
Date: Tue, 7 Oct 2025 14:20:31 +0200

A "gfp_mask" is already passed to kasan_populate_vmalloc() as an argument to respect GFPs from callers and KASAN uses it for its internal allocations.

But apply_to_page_range() function ignores GFP flags due to a hard-coded mask.

Wrap the call with memalloc_apply_gfp_scope()/memalloc_restore_scope() so that non-blocking GFP flags(GFP_ATOMIC, GFP_NOWAIT) are respected.

---

 mm/kasan/shadow.c |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
mm/kasan/shadow.c renamed from mm/kasan/shadow.c~mm-kasan-support-non-blocking-gfp-in-kasan_populate_vmalloc +2 -10
@@ -377,18 +377,10 @@ static int __kasan_populate_vmalloc(unsi
 		 * page tables allocations ignore external gfp mask, enforce it
 		 * by the scope API
 		 */
-		if ((gfp_mask & (__GFP_FS | __GFP_IO)) == __GFP_IO)
-			flags = memalloc_nofs_save();
-		else if ((gfp_mask & (__GFP_FS | __GFP_IO)) == 0)
-			flags = memalloc_noio_save();
-
+		flags = memalloc_apply_gfp_scope(gfp_mask);
 		ret = apply_to_page_range(&init_mm, start, nr_pages * PAGE_SIZE,
 					  kasan_populate_vmalloc_pte, &data);
-
-		if ((gfp_mask & (__GFP_FS | __GFP_IO)) == __GFP_IO)
-			memalloc_nofs_restore(flags);
-		else if ((gfp_mask & (__GFP_FS | __GFP_IO)) == 0)
-			memalloc_noio_restore(flags);
+		memalloc_restore_scope(flags);
 
 		___free_pages_bulk(data.pages, nr_pages);
 		if (ret)

_

Patches currently in -mm which might be from [email protected] are