diff options
authorDave Hansen <>2019-02-25 10:57:38 -0800
committerDan Williams <>2019-02-28 10:41:23 -0800
commit2b539aefe9e48e3908cff02699aa63a8b9bd268e (patch)
parent2794129e902d8eb69413d884dc6404b8716ed9ed (diff)
mm/resource: Let walk_system_ram_range() search child resources
In the process of onlining memory, we use walk_system_ram_range() to find the actual RAM areas inside of the area being onlined. However, it currently only finds memory resources which are "top-level" iomem_resources. Children are not currently searched which causes it to skip System RAM in areas like this (in the format of /proc/iomem): a0000000-bfffffff : Persistent Memory (legacy) a0000000-afffffff : System RAM Changing the true->false here allows children to be searched as well. We need this because we add a new "System RAM" resource underneath the "persistent memory" resource when we use persistent memory in a volatile mode. Signed-off-by: Dave Hansen <> Cc: Keith Busch <> Cc: Dan Williams <> Cc: Dave Jiang <> Cc: Ross Zwisler <> Cc: Vishal Verma <> Cc: Tom Lendacky <> Cc: Andrew Morton <> Cc: Michal Hocko <> Cc: Cc: Cc: Cc: Huang Ying <> Cc: Fengguang Wu <> Cc: Borislav Petkov <> Cc: Bjorn Helgaas <> Cc: Yaowei Bai <> Cc: Takashi Iwai <> Cc: Jerome Glisse <> Signed-off-by: Dan Williams <>
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/resource.c b/kernel/resource.c
index 35fe105d581e..e7f9d2a5db25 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -454,6 +454,9 @@ int walk_mem_res(u64 start, u64 end, void *arg,
* This function calls the @func callback against all memory ranges of type
* System RAM which are marked as IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY.
* It is to be used only for System RAM.
+ *
+ * This will find System RAM ranges that are children of top-level resources
+ * in addition to top-level System RAM resources.
int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
void *arg, int (*func)(unsigned long, unsigned long, void *))
@@ -469,7 +472,7 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
while (start < end &&
!find_next_iomem_res(start, end, flags, IORES_DESC_NONE,
- true, &res)) {
+ false, &res)) {
pfn = (res.start + PAGE_SIZE - 1) >> PAGE_SHIFT;
end_pfn = (res.end + 1) >> PAGE_SHIFT;
if (end_pfn > pfn)