diff mbox series

[06/13] mm/page_alloc: correct return value when failing at preparing

Message ID 20210715042649.CGq7mTI8y%akpm@linux-foundation.org (mailing list archive)
State New
Headers show
Series [01/13] mm: move helper to check slub_debug_enabled | expand

Commit Message

Andrew Morton July 15, 2021, 4:26 a.m. UTC
From: Yanfei Xu <yanfei.xu@windriver.com>
Subject: mm/page_alloc: correct return value when failing at preparing

If the array passed in is already partially populated, we should return
"nr_populated" even failing at preparing arguments stage.

Link: https://lkml.kernel.org/r/20210713152100.10381-3-mgorman@techsingularity.net
Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Link: https://lore.kernel.org/r/20210709102855.55058-1-yanfei.xu@windriver.com
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/page_alloc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

--- a/mm/page_alloc.c~mm-page_alloc-correct-return-value-when-failing-at-preparing
+++ a/mm/page_alloc.c
@@ -5255,7 +5255,7 @@  unsigned long __alloc_pages_bulk(gfp_t g
 	gfp &= gfp_allowed_mask;
 	alloc_gfp = gfp;
 	if (!prepare_alloc_pages(gfp, 0, preferred_nid, nodemask, &ac, &alloc_gfp, &alloc_flags))
-		return 0;
+		return nr_populated;
 	gfp = alloc_gfp;
 
 	/* Find an allowed local zone that meets the low watermark. */