Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp805811imm; Wed, 25 Jul 2018 06:34:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcmDfsG4qAM+Bi1VhxkIKhwhLhPagyNB8dV+mSEeLRRYMqLJCp2CO2IEhPhh8t01h0e+Tfa X-Received: by 2002:a63:d155:: with SMTP id c21-v6mr8841277pgj.188.1532525679836; Wed, 25 Jul 2018 06:34:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532525679; cv=none; d=google.com; s=arc-20160816; b=cTGG3SfZr4KpTeHm14PHcstGPNIjudcxUe35KYaM3eZs0zlv52KtUPt3X6xN8VWmGG /6mB1ijD4Q67743r5IHBpaHzx/ONAE0zUO5h46MnJkHTZGTiuNHpJroNf7NRFegz5teM bONBB4kV2SInplxyaimTsk45W1Ite31AtPvqxOKfFULokdptwNXEz0IvHsa4ixqxPNkA 2OM856dZBHQ848aQBZzegQ3Ewoc4g8TulPBgoW8R0NflCl4QW/1r5T1UdGgUWyyCm5Yx 1PPDVIsbgfDKHgWVji+FLmZSQ6UKGAbHAJWhqOBGZjK+seNgsELGx0vRCC96JYP3GAOH Qbtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=ouZhRUno+yhT7ja8hhiKepUlXSAvtL2erzA+uKY3vdY=; b=MkYOsifF0XEruViDuNMTZ8NoxxeAWCtxg4KFkFOzanitocCug8XIcFRaktlOyWRyU+ ShSkkw26aKIAGV2z68K3vrcr8aC0inbO4CR4jv6XN3GXES1eEGPyd1xpu41UIZlqcs3F 3cp7h6hjoMnQIiL0WylucfFUpv35P8zRtOE8rjIx5CLHY8l/Pg4V7LIbtns7QPAfZcCw iypvgYx9Li1sUIdgA5yYZvONg7mYDTanCZgW0qO41+mFr0jmduzdEeySxezTw0jPbqDP kB+SReeA+Wu8saaU1nDn7B4syAATyztZ4ac6SqqaQmIPn7hmuYrqWkT0jLuBirH9I6NX gg2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=gv8xbmnR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5-v6si14238450pfa.116.2018.07.25.06.34.24; Wed, 25 Jul 2018 06:34:39 -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; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=gv8xbmnR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729156AbeGYOoy (ORCPT + 99 others); Wed, 25 Jul 2018 10:44:54 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:33720 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728452AbeGYOow (ORCPT ); Wed, 25 Jul 2018 10:44:52 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6PDSkYq073303 for ; Wed, 25 Jul 2018 13:33:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : references : in-reply-to : from : date : message-id : subject : to : cc : content-type; s=corp-2018-07-02; bh=ouZhRUno+yhT7ja8hhiKepUlXSAvtL2erzA+uKY3vdY=; b=gv8xbmnRyzJy97JrVfi2roPFvAElCNpP5ZiZQZaICfrBxFhbr+bbVVplP0nQqQuO/NFu eU1WuZMXCDm/luPcRuIj18e6QMjmsbvI8p+zUfnLnLX3Exq1/nCoq+a6UKOu26aV0bSb CVPb1TK88Mc2QX3Pfsp6HYmqTADkhn2VXDmaVDu2bvkxmZoOLXY2lzlcHynaethgZRXc kw0oNhHMcU4N941DQVrTfQigS3DUywN47Xg6mSCQE7KI5Gaw0P2Eelp00jE3vxl59OUc TX8Rt+BfV9KqZLJv9imw9JlnuVFqijVO+xFeE4cUNr4MM7C89lXnOxLtS+Z4hZJuOD9T hw== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2kbv8t5dmd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 25 Jul 2018 13:33:10 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w6PDX8U9001003 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 25 Jul 2018 13:33:09 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w6PDX81Z000480 for ; Wed, 25 Jul 2018 13:33:08 GMT Received: from mail-oi0-f45.google.com (/209.85.218.45) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 25 Jul 2018 06:33:08 -0700 Received: by mail-oi0-f45.google.com with SMTP id y207-v6so13858533oie.13 for ; Wed, 25 Jul 2018 06:33:07 -0700 (PDT) X-Gm-Message-State: AOUpUlFjjyAXv411PCoARzWsdo4R7SWZawhoTGj9towvR5KeB1wUjh6h ASpu6gNYFk1m4QGDDUsG8HOocnj6CFOYrs2cPoo= X-Received: by 2002:aca:4784:: with SMTP id u126-v6mr3512372oia.229.1532525587474; Wed, 25 Jul 2018 06:33:07 -0700 (PDT) MIME-Version: 1.0 References: <20180724235520.10200-1-pasha.tatashin@oracle.com> <20180724235520.10200-3-pasha.tatashin@oracle.com> <20180725121459.GA16987@techadventures.net> In-Reply-To: <20180725121459.GA16987@techadventures.net> From: Pavel Tatashin Date: Wed, 25 Jul 2018 09:32:31 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/3] mm: calculate deferred pages after skipping mirrored memory To: osalvador@techadventures.net Cc: Steven Sistare , Daniel Jordan , LKML , Andrew Morton , kirill.shutemov@linux.intel.com, Michal Hocko , Linux Memory Management List , dan.j.williams@intel.com, jack@suse.cz, jglisse@redhat.com, Souptick Joarder , bhe@redhat.com, gregkh@linuxfoundation.org, Vlastimil Babka , Wei Yang , dave.hansen@intel.com, rientjes@google.com, mingo@kernel.org, abdhalee@linux.vnet.ibm.com, mpe@ellerman.id.au Content-Type: text/plain; charset="UTF-8" X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8964 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807250146 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 25, 2018 at 8:15 AM Oscar Salvador wrote: > > 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. Hi Oscar, Hm, yeah a comment would be appropriate here. I will send an updated patch. I will also change the functions from inline to normal functions as Andrew pointed out: it is not a good idea to use statics in inline functions. Thank you, Pavel