linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_alloc: Return nr_populated when the array is full
@ 2021-06-28 17:15 Chuck Lever
  0 siblings, 0 replies; only message in thread
From: Chuck Lever @ 2021-06-28 17:15 UTC (permalink / raw)
  To: mgorman; +Cc: linux-nfs, linux-mm

The SUNRPC consumer of __alloc_bulk_pages() legitimately calls it
with a full array sometimes. In that case, the correct return code,
according to the API contract, is to return the number of requested
pages.

Fixes: b3b64ebd3822 ("mm/page_alloc: do bulk array bounds check after checking populated elements")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 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 ef2265f86b91..79f88c4ae372 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5058,7 +5058,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
 
 	/* Already populated array? */
 	if (unlikely(page_array && nr_pages - nr_populated == 0))
-		return 0;
+		return nr_pages;
 
 	/* Use the single page allocator for one page. */
 	if (nr_pages - nr_populated == 1)




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-28 17:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28 17:15 [PATCH] mm/page_alloc: Return nr_populated when the array is full Chuck Lever

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox