[PATCH v2] mm/page_alloc: Report 1 as zone_batchsize for !CONFIG_MMU

From: Joshua Hahn

Date: Thu Dec 18 2025 - 03:32:07 EST


Commit 2783088ef24e ("mm/page_alloc: prevent reporting pcp->batch = 0")
moved the error handling (0-handling) of zone_batchsize from its
callers to inside the function. However, the commit left out the error
handling for the NOMMU case, leading to deadlocks on NOMMU systems.

For NOMMU systems, return 1 instead of 0 for zone_batchsize, which restores
the previous deadlock-free behavior.

There is no functional difference expected with this patch before commit
2783088ef24e, other than the pr_debug in zone_pcp_init now printing out
1 instead of 0 for zones in NOMMU systems. Not only is this a pr_debug,
the difference is purely semantic anyways.

Fixes: 2783088ef24e ("mm/page_alloc: prevent reporting pcp->batch = 0")
Reported-by: Daniel Palmer <daniel@xxxxxxxxx>
Closes: https://lore.kernel.org/linux-mm/CAFr9PX=_HaM3_xPtTiBn5Gw5-0xcRpawpJ02NStfdr0khF2k7g@xxxxxxxxxxxxxx/
Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx>
Closes: https://lore.kernel.org/all/42143500-c380-41fe-815c-696c17241506@xxxxxxxxxxxx/
Signed-off-by: Joshua Hahn <joshua.hahnjy@xxxxxxxxx>
---
v1 --> v2:
- Instead of restoring max(1, zone_batchsize(zone)), just return 1 for NOMMU
systems since this is simpler and only affects a single pr_debug.
mm/page_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 822e05f1a964..977cbf20777d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5924,7 +5924,7 @@ static int zone_batchsize(struct zone *zone)
* recycled, this leads to the once large chunks of space being
* fragmented and becoming unavailable for high-order allocations.
*/
- return 0;
+ return 1;
#endif
}


base-commit: 40fbbd64bba6c6e7a72885d2f59b6a3be9991eeb
--
2.47.3