[<prev] [next>] [day] [month] [year] [list]
Message-ID: <HK2PR03MB1684A17E526A6E93444D871E929A0@HK2PR03MB1684.apcprd03.prod.outlook.com>
Date: Tue, 8 May 2018 02:32:47 +0000
From: Huaisheng HS1 Ye <yehs1@...ovo.com>
To: "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>
CC: "mhocko@...e.com" <mhocko@...e.com>,
"willy@...radead.org" <willy@...radead.org>,
"vbabka@...e.cz" <vbabka@...e.cz>,
"mgorman@...hsingularity.net" <mgorman@...hsingularity.net>,
"pasha.tatashin@...cle.com" <pasha.tatashin@...cle.com>,
"alexander.levin@...izon.com" <alexander.levin@...izon.com>,
"hannes@...xchg.org" <hannes@...xchg.org>,
"penguin-kernel@...ove.SAKURA.ne.jp"
<penguin-kernel@...ove.SAKURA.ne.jp>,
"colyli@...e.de" <colyli@...e.de>,
NingTing Cheng <chengnt@...ovo.com>,
"Ocean HY1 He" <hehy1@...ovo.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>
Subject: [External] [RFC PATCH v1 2/6] mm/page_alloc.c: get pfn range with
flags of memblock
This is used to expand the interface of get_pfn_range_for_nid with
flags of memblock, so mm can get pfn range with special flags.
Signed-off-by: Huaisheng Ye <yehs1@...ovo.com>
Signed-off-by: Ocean He <hehy1@...ovo.com>
---
include/linux/mm.h | 4 ++++
mm/page_alloc.c | 17 ++++++++++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index ad06d42..8abf9c9 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2046,6 +2046,10 @@ extern unsigned long absent_pages_in_range(unsigned long start_pfn,
unsigned long end_pfn);
extern void get_pfn_range_for_nid(unsigned int nid,
unsigned long *start_pfn, unsigned long *end_pfn);
+extern void get_pfn_range_for_nid_with_flags(unsigned int nid,
+ unsigned long *start_pfn,
+ unsigned long *end_pfn,
+ unsigned long flags);
extern unsigned long find_min_pfn_with_active_regions(void);
extern void free_bootmem_with_active_regions(int nid,
unsigned long max_low_pfn);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1741dd2..266c065 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5705,13 +5705,28 @@ void __init sparse_memory_present_with_active_regions(int nid)
void __meminit get_pfn_range_for_nid(unsigned int nid,
unsigned long *start_pfn, unsigned long *end_pfn)
{
+ get_pfn_range_for_nid_with_flags(nid, start_pfn, end_pfn,
+ MEMBLOCK_MAX_TYPE);
+}
+
+/*
+ * If MAX_NUMNODES, includes all node memmory regions.
+ * If MEMBLOCK_MAX_TYPE, includes all memory regions with or without Flags.
+ */
+
+void __meminit get_pfn_range_for_nid_with_flags(unsigned int nid,
+ unsigned long *start_pfn,
+ unsigned long *end_pfn,
+ unsigned long flags)
+{
unsigned long this_start_pfn, this_end_pfn;
int i;
*start_pfn = -1UL;
*end_pfn = 0;
- for_each_mem_pfn_range(i, nid, &this_start_pfn, &this_end_pfn, NULL) {
+ for_each_mem_pfn_range_with_flags(i, nid, &this_start_pfn,
+ &this_end_pfn, NULL, flags) {
*start_pfn = min(*start_pfn, this_start_pfn);
*end_pfn = max(*end_pfn, this_end_pfn);
}
--
1.8.3.1
Powered by blists - more mailing lists