Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6207929imm; Wed, 27 Jun 2018 04:10:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe2t9670ONcvVGFtCLtT03+I1lOk13XU+mPxdWmHHd3V5BgxPzeFJ8uywsRUQGda7q7mFd7 X-Received: by 2002:a62:de03:: with SMTP id h3-v6mr5473458pfg.46.1530097806752; Wed, 27 Jun 2018 04:10:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530097806; cv=none; d=google.com; s=arc-20160816; b=PCUa8GHCI7U/nTcdcKVTs43VNJr/1V7EG2aiiojR+JrpbDhWoM6LOorpeeAag0AgzF Zx75RpzWoWT18SNfUEhrZhtNHTvrmOyZ7U5iHT47uhZ7AYN18fUxRhtzX0Cwr4YUg5T8 BXXRG/vTntbod3bL4a8V50nq0PTX4PY5vA0zHsa0pGMJ7ycW5fXaaFqu6y9JmxC4uxZU YBunnlIqv9KO1NzKXf2/PEbIokVBB5IUyxsdTBUUgp/cTtVMKY05Dp1kK3in22yTCdfl FpniJNyN3JW1AYO//ML1pT0aUF2cunVwqGQeD4iZ3heGb9OnYOCbvZJeWMtGIG+X+3Hq Y5tA== 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=tSnyXYNMtB89PyPUvBQ9XzgMaQqobBdr1nFJkfgAOtI=; b=fTQzBaqHnz9NN3XRaT6vvuhCq3ZObRDCb687/MzwhJt5n5mj+/t8eMbW4dy1JbtzaS 4Z2BOqj643/E4/6uRnzZi3xwcbNTkKPC0D8nd+zCYZFore7wVCiz3sgKi6v+SwGd4aAd z17VXNO7nVCYXvazIZIJ3a2P0CIF7ut9Vr44btp806FJPH1UvdCRY+Qwkdu4+gwQ/4LT bM3fDTZGMxsZ+Dth8ZyGGZ7yG9dbGJm4h58Qe29zpgV1RBgnVriEnSZBEBbqRjonGzAQ UsrGcquRd3YzOopwyVEK0cQ9baJNlUxOoYoBcQJv/XbDDYGN79uIGRlUAk+bW6P89LUf MPhQ== 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 x10-v6si3337964pgc.218.2018.06.27.04.09.52; Wed, 27 Jun 2018 04:10:06 -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 S964800AbeF0Jyn (ORCPT + 99 others); Wed, 27 Jun 2018 05:54:43 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:38148 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752035AbeF0Jyl (ORCPT ); Wed, 27 Jun 2018 05:54:41 -0400 Received: by mail-wr0-f196.google.com with SMTP id e18-v6so1374825wrs.5 for ; Wed, 27 Jun 2018 02:54:41 -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=tSnyXYNMtB89PyPUvBQ9XzgMaQqobBdr1nFJkfgAOtI=; b=P6AMYRdTBpJpbi1NIqe5vW7Uf2Jkylw6juOplUDbIWU16aYODBmBjOafrS6rp53Bq+ hReedv+YXZuAWJ4ozwXVOeHwXUo+yzCG6Kww0CGP0iIpWxx/xgG3Ar+OeISX9uK4kkCc GduJqeM5bNC9VGWbS+w79uKny514ks2pEil3TQU9xG5eExs8yAdoHmSN4QbVq4nnEhbd ZxEBcrZQ/+9/x+N+95nldw/6Roa5uumf03EMet3mZppqkAcd6eVQalZM8dgaMtx5o1LT xZWye2UAI1QJnoXw6E2GaCDLJJM5gqF+Xz0KcalJTgpE3NZZRXQrvJ66RkaiFgJNSDML /VUQ== X-Gm-Message-State: APt69E21l5FL67le2axbFAD+ExMjeJbAKnxYv4qb4gPdJ+z/eczgXeTO 4rw4RW5ErwtiTcCmm3TbsoY= X-Received: by 2002:adf:f342:: with SMTP id e2-v6mr4537521wrp.161.1530093280809; Wed, 27 Jun 2018 02:54:40 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id s2-v6sm5858696wrn.75.2018.06.27.02.54.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 02:54:40 -0700 (PDT) Received: by techadventures.net (Postfix, from userid 1000) id 786CB123872; Wed, 27 Jun 2018 11:54:39 +0200 (CEST) Date: Wed, 27 Jun 2018 11:54:39 +0200 From: Oscar Salvador To: Baoquan He Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, dave.hansen@intel.com, pagupta@redhat.com, linux-mm@kvack.org, kirill.shutemov@linux.intel.com Subject: Re: [PATCH v5 2/4] mm/sparsemem: Defer the ms->section_mem_map clearing Message-ID: <20180627095439.GA5924@techadventures.net> References: <20180627013116.12411-1-bhe@redhat.com> <20180627013116.12411-3-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180627013116.12411-3-bhe@redhat.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 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? > } > > 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