mm-page_alloc-replace-kernel_init_pages-with-batch-page-clearing.patch removed from -mm tree
The quilt patch titled
Subject: mm/page_alloc: replace kernel_init_pages() with batch page clearing
has been removed from the -mm tree. Its filename was
mm-page_alloc-replace-kernel_init_pages-with-batch-page-clearing.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: Hrushikesh Salunke <[email protected]>
Subject: mm/page_alloc: replace kernel_init_pages() with batch page clearing
Date: Wed, 22 Apr 2026 10:26:58 +0000
When init_on_alloc is enabled, kernel_init_pages() clears every page one at a time via clear_highpage_kasan_tagged(), which incurs per-page kmap_local_page()/kunmap_local() overhead and prevents the architecture clearing primitive from operating on contiguous ranges.
Introduce clear_highpages_kasan_tagged() as a static batch clearing helper in page_alloc.c that calls clear_pages() for the full contiguous range on !HIGHMEM systems, bypassing the per-page kmap overhead and allowing a single invocation of the arch clearing primitive across the entire allocation. The HIGHMEM path falls back to per-page clearing since those pages require kmap.
Replace kernel_init_pages() with direct calls to the new helper, as it becomes a trivial wrapper.
Allocating 8192 x 2MB HugeTLB pages (16GB) with init_on_alloc=1:
Before: 0.445s
After: 0.166s (-62.7%, 2.68x faster)
Kernel time (sys) reduction per workload with init_on_alloc=1:
Workload Before After Change Graph500 64C128T 30m 41.8s 15m 14.8s -50.3% Graph500 16C32T 15m 56.7s 9m 43.7s -39.0% Pagerank 32T 1m 58.5s 1m 12.8s -38.5% Pagerank 128T 2m 36.3s 1m 40.4s -35.7%
---
mm/page_alloc.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
mm/page_alloc.c renamed from mm/page_alloc.c~mm-page_alloc-replace-kernel_init_pages-with-batch-page-clearing +11 -7
@@ -1211,14 +1211,18 @@ static inline bool should_skip_kasan_poireturn page_kasan_tag (page) ==KASAN_TAG_KERNEL ; } -static void kernel_init_pages (struct page *page,int numpages) +static void clear_highpages_kasan_tagged (struct page *page,int numpages) { -int i; -/* s390's use of memset() could override KASAN redzones. */ kasan_disable_current (); -for (i =0 ; i < numpages; i++) -clear_highpage_kasan_tagged (page + i); +if (!IS_ENABLED (CONFIG_HIGHMEM )) { +clear_pages (kasan_reset_tag (page_address (page)), numpages); + }else { +int i; + +for (i =0 ; i < numpages; i++) +clear_highpage_kasan_tagged (page + i); + }kasan_enable_current (); }
@@ -1423,7 +1427,7 @@ __always_inline bool __free_pages_prepar init = false; }if (init) -kernel_init_pages (page,1 << order); +clear_highpages_kasan_tagged (page,1 << order);/* * arch_free_page() can make the page's contents inaccessible. s390
@@ -1848,7 +1852,7 @@ inline void post_alloc_hook(struct page }/* If memory is still not initialized, initialize it now. */ if (init) -kernel_init_pages (page,1 << order); +clear_highpages_kasan_tagged (page,1 << order);set_page_owner (page, order, gfp_flags);page_table_check_alloc (page, order);
_
Patches currently in -mm which might be from [email protected] are