From patchwork Mon Feb 17 05:58:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 11385247 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 7F3FC1580 for ; Mon, 17 Feb 2020 06:00:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 38F6C20725 for ; Mon, 17 Feb 2020 06:00:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZMj1hOv9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 38F6C20725 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 63A2A6B0007; Mon, 17 Feb 2020 01:00:50 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5F3F16B0008; Mon, 17 Feb 2020 01:00:50 -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 501566B000A; Mon, 17 Feb 2020 01:00:50 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id 390076B0007 for ; Mon, 17 Feb 2020 01:00:50 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C486C824805A for ; Mon, 17 Feb 2020 06:00:49 +0000 (UTC) X-FDA: 76498570218.03.fruit11_2442d1a29260c X-Spam-Summary: 2,0,0,ee29ddb14d9ae268,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:1359: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:4118: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.215.196:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none ,DomainC X-HE-Tag: fruit11_2442d1a29260c X-Filterd-Recvd-Size: 7253 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Mon, 17 Feb 2020 06:00:48 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id u12so8111976pgb.10 for ; Sun, 16 Feb 2020 22:00:49 -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:in-reply-to:references; bh=U7YEPBfcz6tMC3ZCbjxW/XFhdfzjzeWTNjmd2AnVGzM=; b=ZMj1hOv9Ist6xRqmYaZ+zF94BCptF69qVQiNKeAgPU+c9RDYjZYJuzHhIbg4FatNUX 6QeaoWFcYUbmNDCyffW17nCk1+jrAAkEQ3ausgmOC5NJfQzfVdMCn23OvtBQxLPXt70V 1DSfOOzlOKLTiSMVoOTb/sa9pjVB3J2PyoqcBQY957aDkFQeGNP8SNH39VR3LH5nbSLY G9VIQHVXwH8ghESRWgW82jnhgPCc1spQrrOKnm/m1XykVVo9zXTGYQLqUGALqNmG2Ckt a0rzEHfqXjxbF5hVlaykjBHd4G8IRs6rNTsHq/GjGAz19mphrBwMiSgFrR91GS5Lbnbu 6JqA== 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:in-reply-to :references; bh=U7YEPBfcz6tMC3ZCbjxW/XFhdfzjzeWTNjmd2AnVGzM=; b=fXwAAS68iXEcA53FD+TazdnpU24LG+agQi/6xcb1FNrQNjF4DPmEbjW2sy3dt/Czfq 0mNM98PyctXurGQkABimM5ndL2gAREDmysZf90Dv/3HPN5dDj4zO6gtU3WpkiVvy+8BB 98rHqzRhhDrn7NkPcRiB36uWr1BN0/vuplzLWw0TjVlzsgaFjM3HeCDKA9LUiQ7jSy16 mQWBgJErtjzq3raoaQxWBVgHb1mS30brHxpuRbeI6CF3oa3ku7lD+NCOoQwi5D4hfWgc mrNSdebepliuECbJNhivVtaI7V+ZpYAXFqOYm+rTcT1bJLbh+xounuvB13ljqRQ23vsQ +ZDQ== X-Gm-Message-State: APjAAAW+TI4v9N8iMSRVE96x0WGtZR5SX0M/COp5DmO5qPksj4cd17LO kWK3Xeh+nV6PnQPy0Ec//PNRpNQ= X-Google-Smtp-Source: APXvYqyeIxB50iyC3BwDhL2r8ZUJFdRuIgGx9CauEWweL5L3MzJtAuFHWInOWESgN1HMCJrYGb9MHw== X-Received: by 2002:a63:9856:: with SMTP id l22mr13864167pgo.344.1581919247899; Sun, 16 Feb 2020 22:00:47 -0800 (PST) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id h7sm15545713pfq.36.2020.02.16.22.00.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Feb 2020 22:00:47 -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: [PATCHv2] mm/sparse: rename pfn_present() as pfn_in_present_section() Date: Mon, 17 Feb 2020 13:58:30 +0800 Message-Id: <1581919110-29575-1-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: References: 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_in_present_section(). 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 Reviewed-by: David Hildenbrand Acked-by: Michael Ellerman (powerpc) --- v1 -> v2: adopt David's suggestion, rename it as pfn_in_present_section() 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..f3ed1ba 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_in_present_section(pfn)) { phys_addr += MIN_MEMORY_BLOCK_SIZE; continue; } diff --git a/drivers/base/node.c b/drivers/base/node.c index 98a31ba..10d7e81 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_in_present_section(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..f6ceebdb 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_in_present_section(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_in_present_section 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..08ded03 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_in_present_section(pfn)) continue; fail = init_section_page_ext(pfn, nid); } diff --git a/mm/shuffle.c b/mm/shuffle.c index b3fe97f..c716059 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_in_present_section(pfn)) return NULL; /* ...is the page free and currently on a free_area list? */