Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp727306imm; Wed, 25 Jul 2018 05:17:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeH/fXu9S6CGbOCBcGU9jVsRAUlomE1f2CHyXORKc+2R17biHGuBeJb0vZ7aGe26AnYGTrl X-Received: by 2002:a63:d244:: with SMTP id t4-v6mr20503617pgi.335.1532521036420; Wed, 25 Jul 2018 05:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532521036; cv=none; d=google.com; s=arc-20160816; b=f/4BeAluG/o8YW54UD6oS/wrsF2Tb+Ld3+C6PuqPpFZ0zcA+5UGoxXRo9el5pMzP04 QDGKgfBXvK6FUpXS+DWKNTlsWm5ujkTtMZWdU/uD0tSnwDas/LsryCvNPkSYH+glYUQb cuhbiyqlOFJ+VDOlpwa6YcCMDqFS2bsvCpP+NyLO81di1g56nzgnVeZrrXDfMBpprmNJ fKNdpiQMC73bwu+glWZRpZYi02NJZpZY5lKBHzxu7B+kkXgAqNvrcKTJUEyLqYXl3k3d MoHIj1fXbzUfIUxOR1LHN8l6No7lbc1W2ZaKmEnsUpcUl2BFyvWGcZbQxQij2lVmzUdI BHEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Z6S70Lx522ZvfK9hqnX/5d6uCBHzOPCHpz4zqCGOyAQ=; b=ZmBtGaPvQopfow4ev3YRHUFaIhH5YoASX+3XwjgiJ42pOXPhD3JIfnAoOf25snc0Ln iFTixVHojWP7P2se0CYoeKI4hpPKgACz0ceV7IZ8FfHtUA6gWV7VhfqVTksM3yhLoYD8 EnXRerM4xJUx1pCVMIJbvAXurfHSoSWbs0TzzllE1uNygpqUVGyR8f2MBR4jCV24B1Qh hLocEpXPPJsQkPuRrhI3xRuJInKfsb/0crpUNjrt05Do5YROA3oBzxv9Lq7/IHv5sngo 9AdxGR/yiB2IOM1HTsNOcZLeWEty4PfrdP0EdmJmgzLl9uKj4IffBZI30SUWM8MxqV4y ptzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s184-v6si13824752pgb.161.2018.07.25.05.17.01; Wed, 25 Jul 2018 05:17:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728998AbeGYN01 (ORCPT + 99 others); Wed, 25 Jul 2018 09:26:27 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35792 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728762AbeGYN01 (ORCPT ); Wed, 25 Jul 2018 09:26:27 -0400 Received: by mail-wm0-f65.google.com with SMTP id o18-v6so5817446wmc.0 for ; Wed, 25 Jul 2018 05:15:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Z6S70Lx522ZvfK9hqnX/5d6uCBHzOPCHpz4zqCGOyAQ=; b=lZnHATxV87QxIb6N7s0p9Oj+s2DqgFSJIsIG2TI5yZ8uotLlv8ouDHXfafq8DA50r1 rG9jaKw2BxeF3mrGnxyR98duWIcYq+b8XA2+2KSI5bPQJKLMqr5pXfgHYw0A8BG3l4sZ EcIq9hdDvAffdWlAn5XjpVB5/Ut/HvPY28zMCDnP/U9qJUaxHX1CDPSqYy8ZKKM6Nzu6 22OFrOQFl7S/LGaFcgVtzgR65XK2mxj+DazMiJyexh/VuLQ7V/afoKheHhpPFuiGVTS3 jDSf8teqH6ax9SbZ5xlWxmvlCdIkJ2aIMS4rXXbd0aEMqmHfyK5G8OhB5/HifUjXudPm Ybiw== X-Gm-Message-State: AOUpUlGNvvsT+yQOdQtQNRQeaaddMQuPtf3KH3PZ0diqRa9efyy6iyDC 5P1HzFTZR32RErifrIxQJPY= X-Received: by 2002:a1c:1802:: with SMTP id 2-v6mr4380782wmy.81.1532520901376; Wed, 25 Jul 2018 05:15:01 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id 35-v6sm14139304wri.78.2018.07.25.05.15.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 05:15:00 -0700 (PDT) Received: by techadventures.net (Postfix, from userid 1000) id 0270712432E; Wed, 25 Jul 2018 14:14:59 +0200 (CEST) Date: Wed, 25 Jul 2018 14:14:59 +0200 From: Oscar Salvador To: Pavel Tatashin Cc: steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, mhocko@suse.com, linux-mm@kvack.org, dan.j.williams@intel.com, jack@suse.cz, jglisse@redhat.com, jrdr.linux@gmail.com, bhe@redhat.com, gregkh@linuxfoundation.org, vbabka@suse.cz, richard.weiyang@gmail.com, dave.hansen@intel.com, rientjes@google.com, mingo@kernel.org, abdhalee@linux.vnet.ibm.com, mpe@ellerman.id.au Subject: Re: [PATCH 2/3] mm: calculate deferred pages after skipping mirrored memory Message-ID: <20180725121459.GA16987@techadventures.net> References: <20180724235520.10200-1-pasha.tatashin@oracle.com> <20180724235520.10200-3-pasha.tatashin@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180724235520.10200-3-pasha.tatashin@oracle.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 24, 2018 at 07:55:19PM -0400, Pavel Tatashin wrote: > update_defer_init() should be called only when struct page is about to be > initialized. Because it counts number of initialized struct pages, but > there we may skip struct pages if there is some mirrored memory. > > So move, update_defer_init() after checking for mirrored memory. > > Also, rename update_defer_init() to defer_init() and reverse the return > boolean to emphasize that this is a boolean function, that tells that the > reset of memmap initialization should be deferred. > > Make this function self-contained: do not pass number of already > initialized pages in this zone by using static counters. > > Signed-off-by: Pavel Tatashin > --- > mm/page_alloc.c | 40 ++++++++++++++++++++-------------------- > 1 file changed, 20 insertions(+), 20 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index cea749b26394..86c678cec6bd 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -306,24 +306,28 @@ static inline bool __meminit early_page_uninitialised(unsigned long pfn) > } > > /* > - * Returns false when the remaining initialisation should be deferred until > + * Returns true when the remaining initialisation should be deferred until > * later in the boot cycle when it can be parallelised. > */ > -static inline bool update_defer_init(pg_data_t *pgdat, > - unsigned long pfn, unsigned long zone_end, > - unsigned long *nr_initialised) > +static inline bool defer_init(int nid, unsigned long pfn, unsigned long end_pfn) > { > + static unsigned long prev_end_pfn, nr_initialised; > + > + if (prev_end_pfn != end_pfn) { > + prev_end_pfn = end_pfn; > + nr_initialised = 0; > + } Hi Pavel, What about a comment explaining that "if". I am not the brightest one, so it took me a bit to figure out that we got that "if" there because now that the variables are static, we need to somehow track whenever we change to another zone. Thanks -- Oscar Salvador SUSE L3