From patchwork Wed Jun 27 01:31:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 10490385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D584460386 for ; Wed, 27 Jun 2018 01:31:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C60C628A68 for ; Wed, 27 Jun 2018 01:31:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C442C28AA7; Wed, 27 Jun 2018 01:31:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A7C428AE8 for ; Wed, 27 Jun 2018 01:31:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 664166B000D; Tue, 26 Jun 2018 21:31:30 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 613456B000E; Tue, 26 Jun 2018 21:31:30 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 502DF6B0010; Tue, 26 Jun 2018 21:31:30 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f199.google.com (mail-qt0-f199.google.com [209.85.216.199]) by kanga.kvack.org (Postfix) with ESMTP id 28FC56B000D for ; Tue, 26 Jun 2018 21:31:30 -0400 (EDT) Received: by mail-qt0-f199.google.com with SMTP id v14-v6so473782qto.5 for ; Tue, 26 Jun 2018 18:31:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=zelvCbrny18NqAphV5w9BKm6ZXW9Og5Uk0o1PRHyCdc=; b=CLFvWOXs620CNuEQNxGxkoPll1aSUcrxwN1+xMOYdAirsqmPcRIo4Z6XdaNkL/Bn7Q Fyo1HneIZlW4MgTOTIgjF6unGrbNb3HXpc+Z1Az2K/f3z9aGDayROvI9PU4z6o33YqOw EInYICMFPJbf5W8U9Czs1htLo5rZZLxFJTKdI3Hc66mr5FggLuf/wnGoZuFBwRlYUVvY lLKeRZ97Dgde5i0q725dTmILgjh5tZTJL3VVcMx6ZogAtQJsPX7WcVScmh4XiDr9nw6G sT2Nkw8UOTuYybhC1fyY0VMDInapOH1BAGzOPZCf10w6xdYkCWFgtFqF0/8zmh0Wkayk kHow== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: APt69E2pn+C7GaEv+0VUutmKNkKjaPCGrJwGibOnmrgmtP5vx1b3Blll Hq69yGo6w8Q18NuRhAppupmA/t+xBs0U7NznvT7mVE9x2KlqYlc8vExUCHhV+2ky0eiekU+3I1N wf5RaQ6vE3q3339PjetTy5Uo9Cw/WgQiUQ7dNo7+6y/L9iMoYuZKWQNHVlMqGOFYnLg== X-Received: by 2002:a37:9286:: with SMTP id u128-v6mr3378316qkd.29.1530063089958; Tue, 26 Jun 2018 18:31:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpckEzEM4qDuwfq7tlsKo9M6zuKaODlG9AjiYllP1NKc6QOKs1/FW4DBKqQgBXhHg1swDGY2 X-Received: by 2002:a37:9286:: with SMTP id u128-v6mr3378300qkd.29.1530063089414; Tue, 26 Jun 2018 18:31:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530063089; cv=none; d=google.com; s=arc-20160816; b=PNAquKULTEFqkJ06WZLajKgpRImLvAYwa1eZFEWl/clwcR77ofRWb8Fdq6v3dS1eG3 F+PFUUHY+fEbOaT3T0OF6jvCSA9cB461DneU5+1Fy+6ZGy0nLBnF+dinn8c11Y66lBrr OzuUw7iowZeN3UdP0y1POas32XjLj6DIIwEbzjgPEoqxjOP2AagJ6RLT7MThn8IfZ6xd mRWCoKq8BpNGHtqTqqazKtKIA+fjcU5wMNpulaVRLq14zHIIaSQ5/lN5nw1JI71EbhxA bn7wrIpT4bFYKxqrMyBWk+Kq8X6a+mR5JDwWF0CtSvTUkCgwB+vXRAtut8PCYNJpEKFs /o7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=zelvCbrny18NqAphV5w9BKm6ZXW9Og5Uk0o1PRHyCdc=; b=RvLsH9C1z3ZW788HtqxDyUhjjtJ60/4YWrl3f4rJ4WPTOjlFPtSyt4ZpDzvp26PrTm SVSUg1GYP//uejWt/g/O2zsTd106ep5/3Ip6xsF/z81zWoudTXIWKcN20sbIjkcwXSeW sK1O4ywlMNG8Nc48qy5WP43iNBoJZMlzHpSvVQnRkqAs18UmIVQ9F55viLPH41n/IwUq IKsF0G7jNOnKW6YeqLeMVJn13BeVpxHmKYLgKtsP50827ohwl5+knvVM7NlVS5zW+rvQ F0oGkh0U8J6GFb9nGkwI+qVB2vMhcVQGrLiZvwgvrDcjlqL4aaD08JQBBZo3eB7RcygW oNYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id g5-v6si2734944qtd.359.2018.06.26.18.31.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 18:31:29 -0700 (PDT) Received-SPF: pass (google.com: domain of bhe@redhat.com designates 66.187.233.73 as permitted sender) client-ip=66.187.233.73; Authentication-Results: mx.google.com; spf=pass (google.com: domain of bhe@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 22CB8400B455; Wed, 27 Jun 2018 01:31:29 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-8-24.pek2.redhat.com [10.72.8.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A68C111764C; Wed, 27 Jun 2018 01:31:25 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, dave.hansen@intel.com, pagupta@redhat.com Cc: linux-mm@kvack.org, kirill.shutemov@linux.intel.com, Baoquan He Subject: [PATCH v5 1/4] mm/sparse: Add a static variable nr_present_sections Date: Wed, 27 Jun 2018 09:31:13 +0800 Message-Id: <20180627013116.12411-2-bhe@redhat.com> In-Reply-To: <20180627013116.12411-1-bhe@redhat.com> References: <20180627013116.12411-1-bhe@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 27 Jun 2018 01:31:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 27 Jun 2018 01:31:29 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'bhe@redhat.com' RCPT:'' X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP It's used to record how many memory sections are marked as present during system boot up, and will be used in the later patch. Signed-off-by: Baoquan He Reviewed-by: Pavel Tatashin --- mm/sparse.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/sparse.c b/mm/sparse.c index f13f2723950a..6314303130b0 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -200,6 +200,12 @@ static inline int next_present_section_nr(int section_nr) (section_nr <= __highest_present_section_nr)); \ section_nr = next_present_section_nr(section_nr)) +/* + * Record how many memory sections are marked as present + * during system bootup. + */ +static int __initdata nr_present_sections; + /* Record a memory area against a node. */ void __init memory_present(int nid, unsigned long start, unsigned long end) { @@ -229,6 +235,7 @@ void __init memory_present(int nid, unsigned long start, unsigned long end) ms->section_mem_map = sparse_encode_early_nid(nid) | SECTION_IS_ONLINE; section_mark_present(ms); + nr_present_sections++; } } }