From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29412C43613 for ; Thu, 20 Jun 2019 16:10:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 090222070B for ; Thu, 20 Jun 2019 16:10:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732185AbfFTQKx (ORCPT ); Thu, 20 Jun 2019 12:10:53 -0400 Received: from mga06.intel.com ([134.134.136.31]:46060 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726654AbfFTQKx (ORCPT ); Thu, 20 Jun 2019 12:10:53 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2019 09:10:44 -0700 X-IronPort-AV: E=Sophos;i="5.63,397,1557212400"; d="scan'208";a="150979509" Received: from ahduyck-desk1.jf.intel.com ([10.7.198.76]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2019 09:10:44 -0700 Message-ID: <2299c1a5b8773c955e7d0c3803ad3fc6c83c127a.camel@linux.intel.com> Subject: Re: [PATCH] mm: fix regression with deferred struct page init From: Alexander Duyck To: Juergen Gross , xen-devel@lists.xenproject.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Thu, 20 Jun 2019 09:10:44 -0700 In-Reply-To: <20190620160821.4210-1-jgross@suse.com> References: <20190620160821.4210-1-jgross@suse.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2019-06-20 at 18:08 +0200, 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 > Fixes: 0e56acae4b4dd4a9 ("mm: initialize MAX_ORDER_NR_PAGES at a time instead of doing larger sections") > Suggested-by: Alexander Duyck > Signed-off-by: Juergen Gross Acked-by: Alexander Duyck > --- > 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; > } > > /*