Skip to contentSkip to conversation

mm-page_alloc-avoid-overcounting-bulk-alloc-in-watermark-check.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 24

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/page_alloc: avoid overcounting bulk alloc in watermark check
has been removed from the -mm tree. Its filename was
mm-page_alloc-avoid-overcounting-bulk-alloc-in-watermark-check.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: Shengming Hu <[email protected]>
Subject: mm/page_alloc: avoid overcounting bulk alloc in watermark check
Date: Thu, 29 Jan 2026 22:38:14 +0800

alloc_pages_bulk_noprof() only fills NULL slots and already tracks how many entries are pre-populated via nr_populated.

The fast watermark check was adding nr_pages unconditionally, which can overestimate the demand. Use (nr_pages - nr_populated) instead, as an upper bound on the remaining pages this call can still allocate without scanning the whole array.

---

 mm/page_alloc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c renamed from mm/page_alloc.c~mm-page_alloc-avoid-overcounting-bulk-alloc-in-watermark-check +1 -1
@@ -5136,7 +5136,7 @@ unsigned long alloc_pages_bulk_noprof(gf
 
 		cond_accept_memory(zone, 0, alloc_flags);
 retry_this_zone:
-		mark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK) + nr_pages;
+		mark = wmark_pages(zone, alloc_flags & ALLOC_WMARK_MASK) + nr_pages - nr_populated;
 		if (zone_watermark_fast(zone, 0,  mark,
 				zonelist_zone_idx(ac.preferred_zoneref),
 				alloc_flags, gfp)) {

_

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