Re: [Xen-devel] [PATCH] mm: fix regression with deferred struct page init

From: Juergen Gross
Date: Thu Jun 27 2019 - 11:35:43 EST


On 25.06.19 10:25, Juergen Gross wrote:
Gentle ping.

I'd really like to have that in 5.2 in order to avoid the regression
introduced with 5.2-rc1.

Adding some maintainers directly...


Juergen



Juergen

On 20.06.19 18:08, Juergen Gross wrote:
Commit 0e56acae4b4dd4a9 ("mm: initialize MAX_ORDER_NR_PAGES at a time
instead of doing larger sections") is causing a regression on some
systems when the kernel is booted as Xen dom0.

The system will just hang in early boot.

Reason is an endless loop in get_page_from_freelist() in case the first
zone looked at has no free memory. deferred_grow_zone() is always
returning true due to the following code snipplet:

ÂÂ /* If the zone is empty somebody else may have cleared out the zone */
ÂÂ if (!deferred_init_mem_pfn_range_in_zone(&i, zone, &spfn, &epfn,
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ first_deferred_pfn)) {
ÂÂÂÂÂÂÂÂÂÂ pgdat->first_deferred_pfn = ULONG_MAX;
ÂÂÂÂÂÂÂÂÂÂ pgdat_resize_unlock(pgdat, &flags);
ÂÂÂÂÂÂÂÂÂÂ return true;
ÂÂ }

This in turn results in the loop as get_page_from_freelist() is
assuming forward progress can be made by doing some more struct page
initialization.

Cc: Alexander Duyck <alexander.h.duyck@xxxxxxxxxxxxxxx>
Fixes: 0e56acae4b4dd4a9 ("mm: initialize MAX_ORDER_NR_PAGES at a time instead of doing larger sections")
Suggested-by: Alexander Duyck <alexander.h.duyck@xxxxxxxxxxxxxxx>
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 mm/page_alloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d66bc8abe0af..8e3bc949ebcc 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1826,7 +1826,8 @@ deferred_grow_zone(struct zone *zone, unsigned int order)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ first_deferred_pfn)) {
ÂÂÂÂÂÂÂÂÂ pgdat->first_deferred_pfn = ULONG_MAX;
ÂÂÂÂÂÂÂÂÂ pgdat_resize_unlock(pgdat, &flags);
-ÂÂÂÂÂÂÂ return true;
+ÂÂÂÂÂÂÂ /* Retry only once. */
+ÂÂÂÂÂÂÂ return first_deferred_pfn != ULONG_MAX;
ÂÂÂÂÂ }
ÂÂÂÂÂ /*



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel