Skip to content

Commit 2b539ae

Browse files
hansendcdjbw
authored andcommitted
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 <dave.hansen@linux.intel.com> Cc: Keith Busch <keith.busch@intel.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Ross Zwisler <zwisler@kernel.org> Cc: Vishal Verma <vishal.l.verma@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Michal Hocko <mhocko@suse.com> Cc: linux-nvdimm@lists.01.org Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Cc: Huang Ying <ying.huang@intel.com> Cc: Fengguang Wu <fengguang.wu@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Yaowei Bai <baiyaowei@cmss.chinamobile.com> Cc: Takashi Iwai <tiwai@suse.de> Cc: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 2794129 commit 2b539ae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kernel/resource.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,9 @@ int walk_mem_res(u64 start, u64 end, void *arg,
454454
* This function calls the @func callback against all memory ranges of type
455455
* System RAM which are marked as IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY.
456456
* It is to be used only for System RAM.
457+
*
458+
* This will find System RAM ranges that are children of top-level resources
459+
* in addition to top-level System RAM resources.
457460
*/
458461
int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
459462
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,
469472
flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
470473
while (start < end &&
471474
!find_next_iomem_res(start, end, flags, IORES_DESC_NONE,
472-
true, &res)) {
475+
false, &res)) {
473476
pfn = (res.start + PAGE_SIZE - 1) >> PAGE_SHIFT;
474477
end_pfn = (res.end + 1) >> PAGE_SHIFT;
475478
if (end_pfn > pfn)

0 commit comments

Comments
 (0)