Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7813728imm; Thu, 28 Jun 2018 09:37:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK63p3FJBM0u+MfHtgALD1C3ikOV6coQC9s21yomUQxcEYpb0kvS3rdHUMeryu6yzn9GwYD X-Received: by 2002:a63:a319:: with SMTP id s25-v6mr9525007pge.62.1530203871528; Thu, 28 Jun 2018 09:37:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530203871; cv=none; d=google.com; s=arc-20160816; b=NTJhFOU0YGNj3hHArC3Y+Ls7HRkbPfMQSqFKSk2Z6S8F9DxvpPw7ZG2/p7bsl2t24J y2679ADgjMDr6dyDCw0KHJ0+pzhn7oXYnvtSoAJOm9qJsPq3O1AbnHnoNE2gCwNAA6jy 6iqA81Y72p7pEb6sQCiV8rJM2u8P3uxxJ+jvP3j9Oy0zhqF9xUTPRxe2JrYapSaq0xnN 1avlCYlHnoEG3xxtSoRsXGyDnvbI0NpZbaxBviLkClJUBKfMjahCUl0Iy/dfx8UA3U7w XZ2ITYYgdXtinGfT1NyQlBxuyMtZNxNb4bR+YK+RXYMaqYjsxdDcb7d8Dwc3eW55XftY EH9g== 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=wukRn35/Gqa7cQcFvgfdyixlX7iSdLObJORFKfzlyeE=; b=jQ/xeWKDanegKbZc0VLbmlHHAqS+sz6rlq1L7ZjfhCt53QbTCg0eynOwVpwohGt5KV BjAYkvGW1nwUYuPGlfm+d2qQWWA2Qcars14TrlRnMe0vw0OeBDbxp8Phzf379jZ/bLfG kNY7u2xXdHGMYT0J+tvBS0tzk4bYlRb0dYEhznQbcdkNUc52CnhX4fXVWrq3wyh4U1ty YBZOMXl7wNYEQ07IfC+0BYeTnjVbSMyng1+J/Ov6/fdYK+AlExgChhyevXHSKd+W8Kfx 28CLP89UEtBH/UliZMmnROCjh4dXSPjb4+cwwVfCPpyrgQNeSJi6a1DCSxCumyUAK7RJ Ay0g== 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 y20-v6si7100049plp.267.2018.06.28.09.37.23; Thu, 28 Jun 2018 09:37:51 -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 S1753527AbeF1LT6 (ORCPT + 99 others); Thu, 28 Jun 2018 07:19:58 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:34207 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751958AbeF1LT5 (ORCPT ); Thu, 28 Jun 2018 07:19:57 -0400 Received: by mail-wr0-f195.google.com with SMTP id a12-v6so5129138wro.1 for ; Thu, 28 Jun 2018 04:19:56 -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=wukRn35/Gqa7cQcFvgfdyixlX7iSdLObJORFKfzlyeE=; b=YiSBd4XMOSadpZMqAhWSCJ31OKgwqTGPYLIPOLB50i7qOfTzPh0Xk0OzFQ/foKa3XT /+/6YoIQ+OJ1sMEhGZyqRgSsWLMOdC6V8fnYwf7u7CSQnRbh7QCjfyfWQWSvG6zBJVQI pUuERygNvQry4Pnrk+b8U/twi8iou8O07mSdPuI1vqffuncZa3CtHY3uApAEoBrg5HVv yopZNr5tjoH2+MgEkg99j2HohWvaJmpqGvqJjy37e5zQEErMzVgU4US3TI1jkSikpxM6 dcMM7e4kNz02o3PPtbZFB36dKPoVh4Gl/5Hgt1EyHTDPuFWp4bT7glGGve07bdghUreh kAXQ== X-Gm-Message-State: APt69E25gzelHp+n7CksW7LGQs7CrBWnMrP0uRG8yimxcs3GcG8DmE4G p0JBxqkyHudEdJsDoJB2WW0= X-Received: by 2002:adf:ef50:: with SMTP id c16-v6mr7860569wrp.182.1530184796260; Thu, 28 Jun 2018 04:19:56 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id l15-v6sm8952596wrs.95.2018.06.28.04.19.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 04:19:55 -0700 (PDT) Received: by techadventures.net (Postfix, from userid 1000) id 19CCA12390C; Thu, 28 Jun 2018 13:19:54 +0200 (CEST) Date: Thu, 28 Jun 2018 13:19:54 +0200 From: Oscar Salvador To: Baoquan He Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, dave.hansen@intel.com, pagupta@redhat.com, Pavel Tatashin , linux-mm@kvack.org, kirill.shutemov@linux.intel.com Subject: Re: [PATCH v6 2/5] mm/sparsemem: Defer the ms->section_mem_map clearing Message-ID: <20180628111954.GA12956@techadventures.net> References: <20180628062857.29658-1-bhe@redhat.com> <20180628062857.29658-3-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180628062857.29658-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 Thu, Jun 28, 2018 at 02:28:54PM +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 > Reviewed-by: Pavel Tatashin Looks good to me. Reviewed-by: Oscar Salvador > --- > mm/sparse-vmemmap.c | 4 ---- > mm/sparse.c | 15 ++++++++------- > 2 files changed, 8 insertions(+), 11 deletions(-) > > diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c > index bd0276d5f66b..68bb65b2d34d 100644 > --- a/mm/sparse-vmemmap.c > +++ b/mm/sparse-vmemmap.c > @@ -292,18 +292,14 @@ void __init sparse_mem_maps_populate_node(struct page **map_map, > } > > for (pnum = pnum_begin; pnum < pnum_end; pnum++) { > - struct mem_section *ms; > - > if (!present_section_nr(pnum)) > continue; > > map_map[pnum] = sparse_mem_map_populate(pnum, nodeid, NULL); > if (map_map[pnum]) > continue; > - 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; > } > > if (vmemmap_buf_start) { > diff --git a/mm/sparse.c b/mm/sparse.c > index 6314303130b0..6a706093307d 100644 > --- a/mm/sparse.c > +++ b/mm/sparse.c > @@ -441,17 +441,13 @@ void __init sparse_mem_maps_populate_node(struct page **map_map, > > /* fallback */ > for (pnum = pnum_begin; pnum < pnum_end; pnum++) { > - struct mem_section *ms; > - > if (!present_section_nr(pnum)) > continue; > map_map[pnum] = sparse_mem_map_populate(pnum, nodeid, NULL); > if (map_map[pnum]) > continue; > - 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; > } > } > #endif /* !CONFIG_SPARSEMEM_VMEMMAP */ > @@ -479,7 +475,6 @@ static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum) > > pr_err("%s: sparsemem memory map backing failed some memory will not be available\n", > __func__); > - ms->section_mem_map = 0; > return NULL; > } > #endif > @@ -583,17 +578,23 @@ void __init sparse_init(void) > #endif > > for_each_present_section_nr(0, pnum) { > + struct mem_section *ms; > + ms = __nr_to_section(pnum); > usemap = usemap_map[pnum]; > - if (!usemap) > + if (!usemap) { > + ms->section_mem_map = 0; > continue; > + } > > #ifdef CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER > map = map_map[pnum]; > #else > map = sparse_early_mem_map_alloc(pnum); > #endif > - if (!map) > + if (!map) { > + ms->section_mem_map = 0; > continue; > + } > > sparse_init_one_section(__nr_to_section(pnum), pnum, map, > usemap); > -- > 2.13.6 > -- Oscar Salvador SUSE L3