Commit 0c757140 authored by Joshua Hahn's avatar Joshua Hahn Committed by Andrew Morton
Browse files

mm/page_alloc: report 1 as zone_batchsize for !CONFIG_MMU

Commit 2783088e ("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
2783088e, 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.

Link: https://lkml.kernel.org/r/20251218083200.2435789-1-joshua.hahnjy@gmail.com


Fixes: 2783088e ("mm/page_alloc: prevent reporting pcp->batch = 0")
Signed-off-by: default avatarJoshua Hahn <joshua.hahnjy@gmail.com>
Reported-by: default avatarDaniel Palmer <daniel@thingy.jp>
Closes: https://lore.kernel.org/linux-mm/CAFr9PX=_HaM3_xPtTiBn5Gw5-0xcRpawpJ02NStfdr0khF2k7g@mail.gmail.com/


Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
Closes: https://lore.kernel.org/all/42143500-c380-41fe-815c-696c17241506@roeck-us.net/


Reviewed-by: default avatarVlastimil Babka <vbabka@suse.cz>
Tested-by: default avatarDaniel Palmer <daniel@thingy.jp>
Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
Acked-by: default avatarSeongJae Park <sj@kernel.org>
Tested-by: default avatarHajime Tazaki <thehajime@gmail.com>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent f1836639
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
}