Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7105172imm; Wed, 27 Jun 2018 20:27:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfId9mMtPuRJzCHR/poblRUPurq8UDKJwp8CPHmCYwDrhCDt4zWQFdYyWQPwnyUxxQn1rl+ X-Received: by 2002:a62:104e:: with SMTP id y75-v6mr8414009pfi.109.1530156447543; Wed, 27 Jun 2018 20:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530156447; cv=none; d=google.com; s=arc-20160816; b=iF+Tn2KmyIkyy0EbAeU7Hz0QgLbdrMTmjCdGkMNvK7+fDVkZIk3NfX679oe4juenig ZZXaJ64FH7BZoKuMrv3Y8rIxM4eGwHNl3XJoMNHcIueVLSsjMdw3CgM/FL58LhSeYM0w NLa0nTc1EFxFmonP6uZ/NPRWqyBSJyhUogGEoe46eL/gHapN4ygvT+jMDsp4yL8I76mX v+UzvglNJnGUjmPpghmtV8fvQxirXy64dm9iIKxNBBuQJPHq38NbDyqzNKwNy7+01RNx cMOqKw3dLb+fjYY878xuB4QntuZ5jolo+wHUJeHtirssGEW6G6izo03WWv8O94tSQCcX 3qew== 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=iBWHzlbbpRytL0EaAyMctXEsSJ2EInu3/nZSqDgBDEc=; b=kX/cQISM/w9U+6RecCj+TMBu/eV1dMTTp33n0rMs3+hBGyv2XDBZP7sZxyRZvE1fn6 TaSs14pLH5s3msFr1uwuNgbrKjIxsnhGOpaHF53evjNTf+MkNgG/Pug2Hrv20mcaGXkv WpGvU+xZWtB98UHZmRXWJOFHZEenTO/tA6D550FP/sN4mbPXQNsa6AIWss49JT5G5Eh3 2oQR90wKVN22zWkday/G3TSg1iy//+doxKquvFwKkei2qPOMaJ7gzJyPrI3Mcsb1kQoy /C+bziEbfFsQ0vyIEcc9zyDpBkYa92nTPpaOazGTENm/TRftSdGlt92a2ARkQjI869ac N7qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=O0Ai8OLV; 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 b1-v6si5779254pld.323.2018.06.27.20.27.11; Wed, 27 Jun 2018 20:27:27 -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-2017-10-26 header.b=O0Ai8OLV; 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 S932454AbeF1DMP (ORCPT + 99 others); Wed, 27 Jun 2018 23:12:15 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:47336 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932239AbeF1DMN (ORCPT ); Wed, 27 Jun 2018 23:12:13 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5S38ib6114540 for ; Thu, 28 Jun 2018 03:12:13 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-2017-10-26; bh=iBWHzlbbpRytL0EaAyMctXEsSJ2EInu3/nZSqDgBDEc=; b=O0Ai8OLVyAq371KuVyKKCuF7+U6GEW6TdJQT7N3rtwNnlNdmJaUneOSDaDQk50VyxadF i2+6EsM0Tb6LzfbzUfoRTMj0UI+6H/e/vaLP8xlHcJoDRZBp7gt2VspFVaNEtDaV7+Nr C+ChBOADmXcF44SXPP6x5S0IZ8OYSa/ohiuZLiZGMwxS335ZHbl1IsldghhPmDI1paOk aXiHbRAWjPeceet9lScv8ut9zcCELdOcgDRSWsvMl+asJ85aVDMMLZSLFwt8XPRN2q2Z rUELBaoi73Y1IJtEB9E8wnZPrMS9VzdRQUGDj1U8/DgTyCaHtswEkzS+jdVRu/jJJiIH fw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2jukmtyqhj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 28 Jun 2018 03:12:12 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w5S3CCie010749 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 28 Jun 2018 03:12:12 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w5S3CBH4029077 for ; Thu, 28 Jun 2018 03:12:12 GMT Received: from mail-oi0-f41.google.com (/209.85.218.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 27 Jun 2018 20:12:11 -0700 Received: by mail-oi0-f41.google.com with SMTP id r16-v6so3313877oie.3 for ; Wed, 27 Jun 2018 20:12:11 -0700 (PDT) X-Gm-Message-State: APt69E2E+lC1PCg5s70ouo+xnUZu7YpB6YPcUi0s7dQ2z4ktd/VIHaeq JpwuRu8bw69X6K9SQp6/+cJiM5NO6Nwp/rIPvPQ= X-Received: by 2002:aca:db0a:: with SMTP id s10-v6mr5043469oig.339.1530155531435; Wed, 27 Jun 2018 20:12:11 -0700 (PDT) MIME-Version: 1.0 References: <20180627013116.12411-1-bhe@redhat.com> <20180627013116.12411-3-bhe@redhat.com> <20180627095439.GA5924@techadventures.net> <20180627225945.GD8970@localhost.localdomain> In-Reply-To: <20180627225945.GD8970@localhost.localdomain> From: Pavel Tatashin Date: Wed, 27 Jun 2018 23:11:35 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 2/4] mm/sparsemem: Defer the ms->section_mem_map clearing To: bhe@redhat.com Cc: osalvador@techadventures.net, LKML , Andrew Morton , dave.hansen@intel.com, pagupta@redhat.com, Linux Memory Management List , kirill.shutemov@linux.intel.com Content-Type: text/plain; charset="UTF-8" X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8937 signatures=668703 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-1806280031 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Once you remove the ms mentioned by Oscar: Reviewed-by: Pavel Tatashin On Wed, Jun 27, 2018 at 6:59 PM Baoquan He wrote: > > On 06/27/18 at 11:54am, Oscar Salvador wrote: > > On Wed, Jun 27, 2018 at 09:31:14AM +0800, Baoquan He wrote: > > > In sparse_init(), if CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER=y, system > > > will allocate one continuous memory chunk for mem maps on one node and > > > populate the relevant page tables to map memory section one by one. If > > > fail to populate for a certain mem section, print warning and its > > > ->section_mem_map will be cleared to cancel the marking of being present. > > > Like this, the number of mem sections marked as present could become > > > less during sparse_init() execution. > > > > > > Here just defer the ms->section_mem_map clearing if failed to populate > > > its page tables until the last for_each_present_section_nr() loop. This > > > is in preparation for later optimizing the mem map allocation. > > > > > > Signed-off-by: Baoquan He > > > --- > > > mm/sparse-vmemmap.c | 1 - > > > mm/sparse.c | 12 ++++++++---- > > > 2 files changed, 8 insertions(+), 5 deletions(-) > > > > > > diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c > > > index bd0276d5f66b..640e68f8324b 100644 > > > --- a/mm/sparse-vmemmap.c > > > +++ b/mm/sparse-vmemmap.c > > > @@ -303,7 +303,6 @@ void __init sparse_mem_maps_populate_node(struct page **map_map, > > > ms = __nr_to_section(pnum); > > > pr_err("%s: sparsemem memory map backing failed some memory will not be available\n", > > > __func__); > > > - ms->section_mem_map = 0; > > > > Since we are deferring the clearing of section_mem_map, I guess we do not need > > > > struct mem_section *ms; > > ms = __nr_to_section(pnum); > > > > anymore, right? > > Right, good catch, thanks. > > I will post a new round to fix this. > > > > > > } > > > > > > if (vmemmap_buf_start) { > > > diff --git a/mm/sparse.c b/mm/sparse.c > > > index 6314303130b0..71ad53da2cd1 100644 > > > --- a/mm/sparse.c > > > +++ b/mm/sparse.c > > > @@ -451,7 +451,6 @@ void __init sparse_mem_maps_populate_node(struct page **map_map, > > > ms = __nr_to_section(pnum); > > > pr_err("%s: sparsemem memory map backing failed some memory will not be available\n", > > > __func__); > > > - ms->section_mem_map = 0; > > > > The same goes here. > > > > > > > > -- > > Oscar Salvador > > SUSE L3 >