Skip to contentSkip to conversation

RFC [PATCH] x86: try to remove arch_get_ram_range

PATCH Yinghai Lu 3 participants 4 messages Jun 17, 2008 – Jun 18, 2008

Subsystems (6)
Memory management x86 PCI MM core +2 more subsystems
lore
Share & tools
lore

Yinghai Lu

author
#0 lore raw

want to remove arch_get_ram_range, and use early_node_map instead.

arch/x86/mm/init_32.c +4 -2
Index: linux-2.6/arch/x86/mm/init_32.c
===================================================================
@@ -298,7 +298,7 @@ struct add_highpages_data {
 	unsigned long end_pfn;
 };
 
-static void __init add_highpages_work_fn(unsigned long start_pfn,
+static int __init add_highpages_work_fn(unsigned long start_pfn,
 					 unsigned long end_pfn, void *datax)
 {
 	int node_pfn;
@@ -311,7 +311,7 @@ static void __init add_highpages_work_fn
 	final_start_pfn = max(start_pfn, data->start_pfn);
 	final_end_pfn = min(end_pfn, data->end_pfn);
 	if (final_start_pfn >= final_end_pfn)
-		return;
+		return 0;
 
 	for (node_pfn = final_start_pfn; node_pfn < final_end_pfn;
 	     node_pfn++) {
@@ -321,6 +321,8 @@ static void __init add_highpages_work_fn
 		add_one_highpage_init(page, node_pfn);
 	}
 
+	return 0;
+
 }
 
 void __init add_highpages_with_active_regions(int nid, unsigned long start_pfn,
drivers/pci/intel-iommu.c +37 -14

66 lines not on this page · raw message

include/linux/mm.h +1 -1
Index: linux-2.6/include/linux/mm.h
===================================================================
@@ -1011,7 +1011,7 @@ extern unsigned long find_min_pfn_with_a
 extern unsigned long find_max_pfn_with_active_regions(void);
 extern void free_bootmem_with_active_regions(int nid,
 						unsigned long max_low_pfn);
-typedef void (*work_fn_t)(unsigned long, unsigned long, void *);
+typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
 extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
 extern void sparse_memory_present_with_active_regions(int nid);
 #ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
mm/page_alloc.c +7 -3
Index: linux-2.6/mm/page_alloc.c
===================================================================
@@ -2942,10 +2942,14 @@ void __init free_bootmem_with_active_reg
 void __init work_with_active_regions(int nid, work_fn_t work_fn, void *data)
 {
 	int i;
+	int ret;
 
-	for_each_active_range_index_in_nid(i, nid)
-		work_fn(early_node_map[i].start_pfn, early_node_map[i].end_pfn,
-			data);
+	for_each_active_range_index_in_nid(i, nid) {
+		ret = work_fn(early_node_map[i].start_pfn,
+			      early_node_map[i].end_pfn, data);
+		if (ret)
+			break;
+	}
 }
 /**
  * sparse_memory_present_with_active_regions - Call memory_present for each active range
#1 lore raw
Quoted 1 line · Yinghai Lu

want to remove arch_get_ram_range, and use early_node_map instead.

(small request: please include diffstat output in your patches in the future if possible: "quilt refresh --diffstat" will do that - this way people will know why they were Cc:-ed)

this touches the MM:

 arch/x86/mm/init_32.c     |    6 +++--
 drivers/pci/intel-iommu.c |   51 +++++++++++++++++++++++++++++++++-------------
 include/linux/mm.h        |    2 -
 mm/page_alloc.c           |   10 ++++++---
 4 files changed, 49 insertions(+), 20 deletions(-)

but has many dependencies on ongoing arch/x86 work. Andrew, is this change fine with with you?

Ingo

maintainer
#2 lore raw
Quoted 11 lines · On Wed, 18 Jun 2008 16:07:26 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 1 line · Yinghai Lu

want to remove arch_get_ram_range, and use early_node_map instead.

(small request: please include diffstat output in your patches in the future if possible: "quilt refresh --diffstat" will do that - this way people will know why they were Cc:-ed)

this touches the MM:

Quoted 9 lines
 arch/x86/mm/init_32.c     |    6 +++--
 drivers/pci/intel-iommu.c |   51 +++++++++++++++++++++++++++++++++-------------
 include/linux/mm.h        |    2 -
 mm/page_alloc.c           |   10 ++++++---
 4 files changed, 49 insertions(+), 20 deletions(-)

but has many dependencies on ongoing arch/x86 work. Andrew, is this change fine with with you?

Beats me - I don't even have a mm/page_alloc.c:work_with_active_regions() in my tree.

author
#3 lore raw
Quoted 19 lines · Andrew Morton
Quoted 17 lines · On Wed, 18 Jun 2008 16:07:26 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 1 line · Yinghai Lu

want to remove arch_get_ram_range, and use early_node_map instead.

(small request: please include diffstat output in your patches in the future if possible: "quilt refresh --diffstat" will do that - this way people will know why they were Cc:-ed)

this touches the MM:

 arch/x86/mm/init_32.c     |    6 +++--
 drivers/pci/intel-iommu.c |   51 +++++++++++++++++++++++++++++++++-------------
 include/linux/mm.h        |    2 -
 mm/page_alloc.c           |   10 ++++++---
 4 files changed, 49 insertions(+), 20 deletions(-)
Quoted 7 lines
Quoted 3 lines

but has many dependencies on ongoing arch/x86 work. Andrew, is this change fine with with you?

Beats me - I don't even have a mm/page_alloc.c:work_with_active_regions() in my tree.

i cut and paste from tip...

commit a6b01b5fe51a99ecc0844a9e646819941227fd25

Author: Yinghai Lu <[email protected]>
Date:   Mon Jun 16 20:10:55 2008 -0700

RFC x86: try to remove arch_get_ram_range

want to remove arch_get_ram_range, and use early_node_map instead.

mm/page_alloc.c +7 -3
index 67f8f6a..017ac56 100644
@@ -2933,10 +2933,14 @@ void __init free_bootmem_with_active_regions(int nid,
 void __init work_with_active_regions(int nid, work_fn_t work_fn, void *data)
 {
        int i;
+       int ret;
 
-       for_each_active_range_index_in_nid(i, nid)
-               work_fn(early_node_map[i].start_pfn, early_node_map[i].end_pfn,
-                       data);
+       for_each_active_range_index_in_nid(i, nid) {
+               ret = work_fn(early_node_map[i].start_pfn,
+                             early_node_map[i].end_pfn, data);
+               if (ret)
+                       break;
+       }
 }
 /**
  * sparse_memory_present_with_active_regions - Call memory_present

for each active range

commit e827df2898d988698e5b829009255579638a0110

Author: Yinghai Lu <[email protected]>
Date:   Sat Jun 14 18:32:52 2008 -0700

x86, mm: use add_highpages_with_active_regions() for high pages init v2

use early_node_map to init high pages, so we can remove page_is_ram() and page_is_reserved_early() in the big loop with add_one_highpage

also remove page_is_reserved_early(), it is not needed anymore.

v2: fix the build of other platforms

mm/page_alloc.c +8 -0
index 26a028c..8548eea 100644
@@ -2955,6 +2955,14 @@ void __init free_bootmem_with_active_regions(int nid,
        }
 }
 
+void __init work_with_active_regions(int nid, work_fn_t work_fn, void *data)
+{
+       int i;
+
+       for_each_active_range_index_in_nid(i, nid)
+               work_fn(early_node_map[i].start_pfn, early_node_map[i].end_pfn,
+                       data);
+}
 /**
  * sparse_memory_present_with_active_regions - Call memory_present

for each active range
* @nid: The node to call memory_present for. If MAX_NUMNODES, all
nodes will be used.