From patchwork Sat Feb 15 06:17:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 11383737 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1D5851580 for ; Sat, 15 Feb 2020 06:19:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C8EFA2084E for ; Sat, 15 Feb 2020 06:19:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Z+BD4LvD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C8EFA2084E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E4E306B0007; Sat, 15 Feb 2020 01:19:25 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DFE816B0008; Sat, 15 Feb 2020 01:19:25 -0500 (EST) 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 D3C0C6B000A; Sat, 15 Feb 2020 01:19:25 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0120.hostedemail.com [216.40.44.120]) by kanga.kvack.org (Postfix) with ESMTP id BCF956B0007 for ; Sat, 15 Feb 2020 01:19:25 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 488B5180AD81A for ; Sat, 15 Feb 2020 06:19:25 +0000 (UTC) X-FDA: 76491359490.15.hand48_52307f0ddc519 X-Spam-Summary: 2,0,0,b18d1525cb55bdf2,d41d8cd98f00b204,kernelfans@gmail.com,::kernelfans@gmail.com:dan.j.williams@intel.com:mhocko@kernel.org:benh@kernel.crashing.org:paulus@samba.org:mpe@ellerman.id.au:gregkh@linuxfoundation.org:rafael@kernel.org:akpm@linux-foundation.org:david@redhat.com:leonardo@linux.ibm.com:nfont@linux.vnet.ibm.com:nathanl@linux.ibm.com,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1260:1345:1431:1437:1535:1543:1711:1730:1747:1777:1792:1801:2194:2196:2198:2199:2200:2201:2393:2559:2562:2693:2731:2898:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:4117:4321:4385:4605:5007:6119:6261:6653:6742:7514:7903:9010:9413:10004:11026:11473:11657:11658:11914:12043:12114:12296:12297:12438:12517:12519:12555:12895:12986:13846:13972:14096:14181:14394:14687:14721:21063:21080:21444:21451:21627:21666:21990:30054:30064:30070,0,RBL:209.85.210.194:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,Doma inCache: X-HE-Tag: hand48_52307f0ddc519 X-Filterd-Recvd-Size: 6949 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Sat, 15 Feb 2020 06:19:24 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id n7so6053594pfn.0 for ; Fri, 14 Feb 2020 22:19:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/OPGaJxaaajS+Iq4qEg33ypTxrSh3hRB4fNzpkoZ1Bo=; b=Z+BD4LvD5ElB51vqNMzp9Z4na2lmvgrC2zlIIj1GyMhmf/9LRn0J2k93aFA0lmYqcN iXCRTuuVwn+grcDdMNThrS0taZs41IqRytEfFhZOzrL2tDZbU0q1kxh0yX+5OE2/euvd ygctMXkTk4rcaComr3jzoJ6n+K4STltDoYD7buvedNCywUcw1OWMAxx3MO7ff100jq44 UZ3XxUXdAstLWu5wTtCVU3DPJjDbuq27PuYq38Gba23HcwmvGurVBG7xTr20iYVeavqd CrESflQxLqyiPoTRW4Bt6Tk/5LocVCpBdtXR8lf1y+cvCWLSsstLu7xRUJ+2GTJsxpcF Z0xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/OPGaJxaaajS+Iq4qEg33ypTxrSh3hRB4fNzpkoZ1Bo=; b=Q8H+MHbc26+8Keq8PC0lBjcAcPnOZgACcC9N1nBw1vxp3JjocV0ilgaty3MZ0/Sasx BHeZ7pn5CllmSKxeVc7LP6lKsd/kga0J8oXwvsVJCUhHNlXQ9a9T8LNTbeAPQ4T6n0jk GLWfsM00f8f2driDlt2tWn+BtlQElAevQ3pqn4omGsop4iGPZgznAsSV3DmDcd5HmCi0 mqaEXqlTWs1AnRgBRs2APcC0aed6cSwVQHGEa6/8TnS9O77gERJ9ZitPeB4h4hbKkn5u 8EN8cxzjm9EM1lbY21SMkwtmuJNBhMz0BB+yyAiRMXVb5LilCbaaTGSXm/rDci7UbM+b U1sQ== X-Gm-Message-State: APjAAAWpg4ufPIIC1cZhyJqV2ujCqJWm5WuZmnBN35ni4d2N0E9TyqCN x8P6HOOcACJUPYKPZTDdwhPHuJA= X-Google-Smtp-Source: APXvYqwib/bvjnuUDuAlria2z8spylDveGIv4+tzuUYPx+D3hxb7NGQAHsneqJu+TvkxVWcmV+gdzQ== X-Received: by 2002:a63:d441:: with SMTP id i1mr7558388pgj.426.1581747563526; Fri, 14 Feb 2020 22:19:23 -0800 (PST) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id 200sm8918330pfz.121.2020.02.14.22.19.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Feb 2020 22:19:23 -0800 (PST) From: Pingfan Liu To: linux-mm@kvack.org Cc: Pingfan Liu , Dan Williams , Michal Hocko , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Greg Kroah-Hartman , "Rafael J. Wysocki" , Andrew Morton , David Hildenbrand , Leonardo Bras , Nathan Fontenot , Nathan Lynch Subject: [PATCH] mm/sparse: rename pfn_present() as pfn_to_section_present() Date: Sat, 15 Feb 2020 14:17:02 +0800 Message-Id: <1581747422-7388-1-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.5 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: After introducing mem sub section concept, pfn_present() loses its literal meaning, and will not be necessary a truth on partial populated mem section. Since all of the callers use it to judge an absent section, it is better to rename pfn_present() as pfn_to_section_present(). Signed-off-by: Pingfan Liu Cc: Dan Williams Cc: Michal Hocko Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Andrew Morton Cc: David Hildenbrand Cc: Leonardo Bras Cc: Nathan Fontenot Cc: Nathan Lynch To: linux-mm@kvack.org --- arch/powerpc/platforms/pseries/hotplug-memory.c | 2 +- drivers/base/node.c | 2 +- include/linux/mmzone.h | 4 ++-- mm/page_ext.c | 2 +- mm/shuffle.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index a4d40a3..5088132 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c @@ -360,7 +360,7 @@ static bool lmb_is_removable(struct drmem_lmb *lmb) for (i = 0; i < scns_per_block; i++) { pfn = PFN_DOWN(phys_addr); - if (!pfn_present(pfn)) { + if (!pfn_to_section_present(pfn)) { phys_addr += MIN_MEMORY_BLOCK_SIZE; continue; } diff --git a/drivers/base/node.c b/drivers/base/node.c index 98a31ba..6f98568 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -772,7 +772,7 @@ static int register_mem_sect_under_node(struct memory_block *mem_blk, * memory block could have several absent sections from start. * skip pfn range from absent section */ - if (!pfn_present(pfn)) { + if (!pfn_to_section_present(pfn)) { pfn = round_down(pfn + PAGES_PER_SECTION, PAGES_PER_SECTION) - 1; continue; diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 462f687..eca2db7 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1372,7 +1372,7 @@ static inline int pfn_valid(unsigned long pfn) } #endif -static inline int pfn_present(unsigned long pfn) +static inline int pfn_to_section_present(unsigned long pfn) { if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) return 0; @@ -1409,7 +1409,7 @@ void sparse_init(void); #else #define sparse_init() do {} while (0) #define sparse_index_init(_sec, _nid) do {} while (0) -#define pfn_present pfn_valid +#define pfn_to_section_present pfn_valid #define subsection_map_init(_pfn, _nr_pages) do {} while (0) #endif /* CONFIG_SPARSEMEM */ diff --git a/mm/page_ext.c b/mm/page_ext.c index 4ade843..df0e55e 100644 --- a/mm/page_ext.c +++ b/mm/page_ext.c @@ -304,7 +304,7 @@ static int __meminit online_page_ext(unsigned long start_pfn, } for (pfn = start; !fail && pfn < end; pfn += PAGES_PER_SECTION) { - if (!pfn_present(pfn)) + if (!pfn_to_section_present(pfn)) continue; fail = init_section_page_ext(pfn, nid); } diff --git a/mm/shuffle.c b/mm/shuffle.c index b3fe97f..9242cc8 100644 --- a/mm/shuffle.c +++ b/mm/shuffle.c @@ -72,7 +72,7 @@ static struct page * __meminit shuffle_valid_page(unsigned long pfn, int order) return NULL; /* ...is the pfn in a present section or a hole? */ - if (!pfn_present(pfn)) + if (!pfn_to_section_present(pfn)) return NULL; /* ...is the page free and currently on a free_area list? */