Skip to contentSkip to conversation

x86: set_highmem_pages_init() cleanup

PATCH Applied Pekka Enberg 2 participants 9 messages Mar 3, 2009 – Mar 4, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: set_highmem_pages_init() cleanup

From: Pekka Enberg <[email protected]>

Impact: cleanup

This patch moves set_highmem_pages_init() to arch/x86/mm/highmem_32.c. The declaration of the function is kept in asm/numa_32.h because asm/highmem.h is included only CONFIG_HIGHMEM is enabled so we can't put the empty static inline function there.

---
 arch/x86/include/asm/numa_32.h |    6 +++++-
 arch/x86/mm/highmem_32.c       |   34 ++++++++++++++++++++++++++++++++++
 arch/x86/mm/init_32.c          |   12 ------------
 arch/x86/mm/numa_32.c          |   26 --------------------------
 4 files changed, 39 insertions(+), 39 deletions(-)
arch/x86/include/asm/numa_32.h +5 -1
index e9f5db7..a372290 100644
@@ -4,8 +4,12 @@
 extern int pxm_to_nid(int pxm);
 extern void numa_remove_cpu(int cpu);
 
-#ifdef CONFIG_NUMA
+#ifdef CONFIG_HIGHMEM
 extern void set_highmem_pages_init(void);
+#else
+static inline void set_highmem_pages_init(void)
+{
+}
 #endif
 
 #endif /* _ASM_X86_NUMA_32_H */
arch/x86/mm/highmem_32.c +34 -0
index bcc079c..13a823c 100644
@@ -1,5 +1,6 @@
 #include <linux/highmem.h>
 #include <linux/module.h>
+#include <linux/swap.h> /* for totalram_pages */
 
 void *kmap(struct page *page)
 {
@@ -156,3 +157,36 @@ EXPORT_SYMBOL(kmap);
 EXPORT_SYMBOL(kunmap);
 EXPORT_SYMBOL(kmap_atomic);
 EXPORT_SYMBOL(kunmap_atomic);
+
+#ifdef CONFIG_NUMA
+void __init set_highmem_pages_init(void)
+{
+	struct zone *zone;
+	int nid;
+
+	for_each_zone(zone) {
+		unsigned long zone_start_pfn, zone_end_pfn;
+
+		if (!is_highmem(zone))
+			continue;
+
+		zone_start_pfn = zone->zone_start_pfn;
+		zone_end_pfn = zone_start_pfn + zone->spanned_pages;
+
+		nid = zone_to_nid(zone);
+		printk(KERN_INFO "Initializing %s for node %d (%08lx:%08lx)\n",
+				zone->name, nid, zone_start_pfn, zone_end_pfn);
+
+		add_highpages_with_active_regions(nid, zone_start_pfn,
+				 zone_end_pfn);
+	}
+	totalram_pages += totalhigh_pages;
+}
+#else
+static void __init set_highmem_pages_init(void)
+{
+	add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
+
+	totalram_pages += totalhigh_pages;
+}
+#endif /* CONFIG_NUMA */
arch/x86/mm/init_32.c +0 -12
index 6fbf39f..11b827d 100644
@@ -468,22 +468,10 @@ void __init add_highpages_with_active_regions(int nid, unsigned long start_pfn,
 	work_with_active_regions(nid, add_highpages_work_fn, &data);
 }
 
-#ifndef CONFIG_NUMA
-static void __init set_highmem_pages_init(void)
-{
-	add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
-
-	totalram_pages += totalhigh_pages;
-}
-#endif /* !CONFIG_NUMA */
-
 #else
 static inline void permanent_kmaps_init(pgd_t *pgd_base)
 {
 }
-static inline void set_highmem_pages_init(void)
-{
-}
 #endif /* CONFIG_HIGHMEM */
 
 void __init native_pagetable_setup_start(pgd_t *base)
arch/x86/mm/numa_32.c +0 -26
index d1f7439..a04092a 100644
@@ -423,32 +423,6 @@ void __init initmem_init(unsigned long start_pfn,
 	setup_bootmem_allocator();
 }
 
-void __init set_highmem_pages_init(void)
-{
-#ifdef CONFIG_HIGHMEM
-	struct zone *zone;
-	int nid;
-
-	for_each_zone(zone) {
-		unsigned long zone_start_pfn, zone_end_pfn;
-
-		if (!is_highmem(zone))
-			continue;
-
-		zone_start_pfn = zone->zone_start_pfn;
-		zone_end_pfn = zone_start_pfn + zone->spanned_pages;
-
-		nid = zone_to_nid(zone);
-		printk(KERN_INFO "Initializing %s for node %d (%08lx:%08lx)\n",
-				zone->name, nid, zone_start_pfn, zone_end_pfn);
-
-		add_highpages_with_active_regions(nid, zone_start_pfn,
-				 zone_end_pfn);
-	}
-	totalram_pages += totalhigh_pages;
-#endif
-}
-
 #ifdef CONFIG_MEMORY_HOTPLUG
 static int paddr_to_nid(u64 addr)
 {
Signature · 1 line
1.5.4.3
Applied
#1 lore raw
Quoted 9 lines · Pekka Enberg

From: Pekka Enberg <[email protected]>

Impact: cleanup

This patch moves set_highmem_pages_init() to arch/x86/mm/highmem_32.c. The declaration of the function is kept in asm/numa_32.h because asm/highmem.h is included only CONFIG_HIGHMEM is enabled so we can't put the empty static inline function there.

Quoted 7 lines
---
 arch/x86/include/asm/numa_32.h |    6 +++++-
 arch/x86/mm/highmem_32.c       |   34 ++++++++++++++++++++++++++++++++++
 arch/x86/mm/init_32.c          |   12 ------------
 arch/x86/mm/numa_32.c          |   26 --------------------------
 4 files changed, 39 insertions(+), 39 deletions(-)

Applied, thanks!

One question:

Quoted 56 lines
arch/x86/include/asm/numa_32.h +5 -1
index e9f5db7..a372290 100644
@@ -4,8 +4,12 @@
 extern int pxm_to_nid(int pxm);
 extern void numa_remove_cpu(int cpu);
 
-#ifdef CONFIG_NUMA
+#ifdef CONFIG_HIGHMEM
 extern void set_highmem_pages_init(void);
+#else
+static inline void set_highmem_pages_init(void)
+{
+}
 #endif
 
 #endif /* _ASM_X86_NUMA_32_H */
arch/x86/mm/highmem_32.c +24 -0
index bcc079c..13a823c 100644
@@ -1,5 +1,6 @@
 #include <linux/highmem.h>
 #include <linux/module.h>
+#include <linux/swap.h> /* for totalram_pages */
 
 void *kmap(struct page *page)
 {
@@ -156,3 +157,36 @@ EXPORT_SYMBOL(kmap);
 EXPORT_SYMBOL(kunmap);
 EXPORT_SYMBOL(kmap_atomic);
 EXPORT_SYMBOL(kunmap_atomic);
+
+#ifdef CONFIG_NUMA
+void __init set_highmem_pages_init(void)
+{
+	struct zone *zone;
+	int nid;
+
+	for_each_zone(zone) {
+		unsigned long zone_start_pfn, zone_end_pfn;
+
+		if (!is_highmem(zone))
+			continue;
+
+		zone_start_pfn = zone->zone_start_pfn;
+		zone_end_pfn = zone_start_pfn + zone->spanned_pages;
+
+		nid = zone_to_nid(zone);
+		printk(KERN_INFO "Initializing %s for node %d (%08lx:%08lx)\n",
+				zone->name, nid, zone_start_pfn, zone_end_pfn);
+
+		add_highpages_with_active_regions(nid, zone_start_pfn,
+				 zone_end_pfn);
+	}

arch/x86/mm/highmem_32.c EXPORT_SYMBOL(kmap); · line 192

Quoted 10 lines
arch/x86/mm/highmem_32.c +10 -0
+	totalram_pages += totalhigh_pages;
+}
+#else
+static void __init set_highmem_pages_init(void)
+{
+	add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
+
+	totalram_pages += totalhigh_pages;
+}
+#endif /* CONFIG_NUMA */

Couldnt we just wrap the !NUMA case into the NUMA case and just have the NUMA function present, by making for_each_zone() a two-entries matter and making the second entry contain:

zone->zone_start_pfn := highstart_pfn zone->spanned_pages := highend_pfn-highstart_pfn

?

Ingo

#2 lore raw
Quoted 94 lines · Ingo Molnar
Quoted 9 lines · Pekka Enberg

From: Pekka Enberg <[email protected]>

Impact: cleanup

This patch moves set_highmem_pages_init() to arch/x86/mm/highmem_32.c. The declaration of the function is kept in asm/numa_32.h because asm/highmem.h is included only CONFIG_HIGHMEM is enabled so we can't put the empty static inline function there.

Quoted 7 lines
---
 arch/x86/include/asm/numa_32.h |    6 +++++-
 arch/x86/mm/highmem_32.c       |   34 ++++++++++++++++++++++++++++++++++
 arch/x86/mm/init_32.c          |   12 ------------
 arch/x86/mm/numa_32.c          |   26 --------------------------
 4 files changed, 39 insertions(+), 39 deletions(-)

Applied, thanks!

One question:

Quoted 56 lines
arch/x86/include/asm/numa_32.h +5 -1
index e9f5db7..a372290 100644
@@ -4,8 +4,12 @@
 extern int pxm_to_nid(int pxm);
 extern void numa_remove_cpu(int cpu);
 
-#ifdef CONFIG_NUMA
+#ifdef CONFIG_HIGHMEM
 extern void set_highmem_pages_init(void);
+#else
+static inline void set_highmem_pages_init(void)
+{
+}
 #endif
 
 #endif /* _ASM_X86_NUMA_32_H */
arch/x86/mm/highmem_32.c +24 -0
index bcc079c..13a823c 100644
@@ -1,5 +1,6 @@
 #include <linux/highmem.h>
 #include <linux/module.h>
+#include <linux/swap.h> /* for totalram_pages */
 
 void *kmap(struct page *page)
 {
@@ -156,3 +157,36 @@ EXPORT_SYMBOL(kmap);
 EXPORT_SYMBOL(kunmap);
 EXPORT_SYMBOL(kmap_atomic);
 EXPORT_SYMBOL(kunmap_atomic);
+
+#ifdef CONFIG_NUMA
+void __init set_highmem_pages_init(void)
+{
+	struct zone *zone;
+	int nid;
+
+	for_each_zone(zone) {
+		unsigned long zone_start_pfn, zone_end_pfn;
+
+		if (!is_highmem(zone))
+			continue;
+
+		zone_start_pfn = zone->zone_start_pfn;
+		zone_end_pfn = zone_start_pfn + zone->spanned_pages;
+
+		nid = zone_to_nid(zone);
+		printk(KERN_INFO "Initializing %s for node %d (%08lx:%08lx)\n",
+				zone->name, nid, zone_start_pfn, zone_end_pfn);
+
+		add_highpages_with_active_regions(nid, zone_start_pfn,
+				 zone_end_pfn);
+	}

arch/x86/mm/highmem_32.c EXPORT_SYMBOL(kmap); · line 192

Quoted 10 lines
arch/x86/mm/highmem_32.c +10 -0
+	totalram_pages += totalhigh_pages;
+}
+#else
+static void __init set_highmem_pages_init(void)
+{
+	add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
+
+	totalram_pages += totalhigh_pages;
+}
+#endif /* CONFIG_NUMA */

Couldnt we just wrap the !NUMA case into the NUMA case and just have the NUMA function present, by making for_each_zone() a two-entries matter and making the second entry contain:

Quoted 2 lines
   zone->zone_start_pfn := highstart_pfn
   zone->spanned_pages := highend_pfn-highstart_pfn 

OK, I don't quite understand your suggestion here. The zones are set up completely at this stage so AFAICT, even for the UMA case, there should be a highmem zone there. So unless I am missing something here, I think we can get away with something as simple as the following.

I don't have any highmem machines to test this but some printk()'s seem to confirm this (although for machines that don't have any highmem available, ->zone_start_pfn is zero (whereas highstart_pfn is non-zero). I think that's because of the !size test in free_area_init_core() but AFAICT, it's fine as add_highpages_with_active_regions() takes care of that nicely.

But I'll cc Mel just in case... :-)

Pekka

Quoted 1 line

From 29c85778896d263ce5c59c496c13548488b7593c Mon Sep 17 00:00:00 2001

From: Pekka Enberg <[email protected]>
Date: Wed, 4 Mar 2009 10:10:53 +0200
Subject: [PATCH] x86: unify uma and numa copies of set_highmem_pages_init()

Impact: cleanup

The zones are set up at this stage so there's a highmem zone available even for the UMA case. The only difference there is that for machines that have CONFIG_HIGHMEM enabled but don't have any highmem available, ->zone_start_pfn is zero whereas highstart_pfn is non-zero). The field is left zeroed because of the !size test in free_area_init_core() but shouldn't be a problem because add_highpages_with_active_regions() handles empty ranges just fine.

---
 arch/x86/mm/highmem_32.c |    9 ---------
 1 files changed, 0 insertions(+), 9 deletions(-)
arch/x86/mm/highmem_32.c +0 -9
index 00f127c..d117453 100644
@@ -158,7 +158,6 @@ EXPORT_SYMBOL(kunmap);
 EXPORT_SYMBOL(kmap_atomic);
 EXPORT_SYMBOL(kunmap_atomic);
 
-#ifdef CONFIG_NUMA
 void __init set_highmem_pages_init(void)
 {
 	struct zone *zone;
@@ -182,11 +181,3 @@ void __init set_highmem_pages_init(void)
 	}
 	totalram_pages += totalhigh_pages;
 }
-#else
-void __init set_highmem_pages_init(void)
-{
-	add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
-
-	totalram_pages += totalhigh_pages;
-}
-#endif /* CONFIG_NUMA */
Signature · 1 line
1.5.4.3
#3 lore raw
Quoted 95 lines · Pekka Enberg
Quoted 94 lines · Ingo Molnar
Quoted 9 lines · Pekka Enberg

From: Pekka Enberg <[email protected]>

Impact: cleanup

This patch moves set_highmem_pages_init() to arch/x86/mm/highmem_32.c. The declaration of the function is kept in asm/numa_32.h because asm/highmem.h is included only CONFIG_HIGHMEM is enabled so we can't put the empty static inline function there.

Quoted 7 lines
---
 arch/x86/include/asm/numa_32.h |    6 +++++-
 arch/x86/mm/highmem_32.c       |   34 ++++++++++++++++++++++++++++++++++
 arch/x86/mm/init_32.c          |   12 ------------
 arch/x86/mm/numa_32.c          |   26 --------------------------
 4 files changed, 39 insertions(+), 39 deletions(-)

Applied, thanks!

One question:

Quoted 56 lines
arch/x86/include/asm/numa_32.h +5 -1
index e9f5db7..a372290 100644
@@ -4,8 +4,12 @@
 extern int pxm_to_nid(int pxm);
 extern void numa_remove_cpu(int cpu);
 
-#ifdef CONFIG_NUMA
+#ifdef CONFIG_HIGHMEM
 extern void set_highmem_pages_init(void);
+#else
+static inline void set_highmem_pages_init(void)
+{
+}
 #endif
 
 #endif /* _ASM_X86_NUMA_32_H */
arch/x86/mm/highmem_32.c +24 -0
index bcc079c..13a823c 100644
@@ -1,5 +1,6 @@
 #include <linux/highmem.h>
 #include <linux/module.h>
+#include <linux/swap.h> /* for totalram_pages */
 
 void *kmap(struct page *page)
 {
@@ -156,3 +157,36 @@ EXPORT_SYMBOL(kmap);
 EXPORT_SYMBOL(kunmap);
 EXPORT_SYMBOL(kmap_atomic);
 EXPORT_SYMBOL(kunmap_atomic);
+
+#ifdef CONFIG_NUMA
+void __init set_highmem_pages_init(void)
+{
+	struct zone *zone;
+	int nid;
+
+	for_each_zone(zone) {
+		unsigned long zone_start_pfn, zone_end_pfn;
+
+		if (!is_highmem(zone))
+			continue;
+
+		zone_start_pfn = zone->zone_start_pfn;
+		zone_end_pfn = zone_start_pfn + zone->spanned_pages;
+
+		nid = zone_to_nid(zone);
+		printk(KERN_INFO "Initializing %s for node %d (%08lx:%08lx)\n",
+				zone->name, nid, zone_start_pfn, zone_end_pfn);
+
+		add_highpages_with_active_regions(nid, zone_start_pfn,
+				 zone_end_pfn);
+	}

arch/x86/mm/highmem_32.c EXPORT_SYMBOL(kmap); · line 192

Quoted 10 lines
arch/x86/mm/highmem_32.c +10 -0
+	totalram_pages += totalhigh_pages;
+}
+#else
+static void __init set_highmem_pages_init(void)
+{
+	add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
+
+	totalram_pages += totalhigh_pages;
+}
+#endif /* CONFIG_NUMA */

Couldnt we just wrap the !NUMA case into the NUMA case and just have the NUMA function present, by making for_each_zone() a two-entries matter and making the second entry contain:

Quoted 8 lines
Quoted 2 lines
   zone->zone_start_pfn := highstart_pfn
   zone->spanned_pages := highend_pfn-highstart_pfn 

OK, I don't quite understand your suggestion here. The zones are set up completely at this stage so AFAICT, even for the UMA case, there should be a highmem zone there. So unless I am missing something here, I think we can get away with something as simple as the following.

ok, good - it is an easier cleanup than i hoped it would be :-)

Ingo

#4 lore raw
Quoted 101 lines · Ingo Molnar
Quoted 98 lines · Pekka Enberg
Quoted 96 lines · Ingo Molnar
Quoted 9 lines · Pekka Enberg

From: Pekka Enberg <[email protected]>

Impact: cleanup

This patch moves set_highmem_pages_init() to arch/x86/mm/highmem_32.c. The declaration of the function is kept in asm/numa_32.h because asm/highmem.h is included only CONFIG_HIGHMEM is enabled so we can't put the empty static inline function there.

Quoted 7 lines
---
 arch/x86/include/asm/numa_32.h |    6 +++++-
 arch/x86/mm/highmem_32.c       |   34 ++++++++++++++++++++++++++++++++++
 arch/x86/mm/init_32.c          |   12 ------------
 arch/x86/mm/numa_32.c          |   26 --------------------------
 4 files changed, 39 insertions(+), 39 deletions(-)

Applied, thanks!

One question:

Quoted 56 lines
arch/x86/include/asm/numa_32.h +5 -1
index e9f5db7..a372290 100644
@@ -4,8 +4,12 @@
 extern int pxm_to_nid(int pxm);
 extern void numa_remove_cpu(int cpu);
 
-#ifdef CONFIG_NUMA
+#ifdef CONFIG_HIGHMEM
 extern void set_highmem_pages_init(void);
+#else
+static inline void set_highmem_pages_init(void)
+{
+}
 #endif
 
 #endif /* _ASM_X86_NUMA_32_H */
arch/x86/mm/highmem_32.c +24 -0
index bcc079c..13a823c 100644
@@ -1,5 +1,6 @@
 #include <linux/highmem.h>
 #include <linux/module.h>
+#include <linux/swap.h> /* for totalram_pages */
 
 void *kmap(struct page *page)
 {
@@ -156,3 +157,36 @@ EXPORT_SYMBOL(kmap);
 EXPORT_SYMBOL(kunmap);
 EXPORT_SYMBOL(kmap_atomic);
 EXPORT_SYMBOL(kunmap_atomic);
+
+#ifdef CONFIG_NUMA
+void __init set_highmem_pages_init(void)
+{
+	struct zone *zone;
+	int nid;
+
+	for_each_zone(zone) {
+		unsigned long zone_start_pfn, zone_end_pfn;
+
+		if (!is_highmem(zone))
+			continue;
+
+		zone_start_pfn = zone->zone_start_pfn;
+		zone_end_pfn = zone_start_pfn + zone->spanned_pages;
+
+		nid = zone_to_nid(zone);
+		printk(KERN_INFO "Initializing %s for node %d (%08lx:%08lx)\n",
+				zone->name, nid, zone_start_pfn, zone_end_pfn);
+
+		add_highpages_with_active_regions(nid, zone_start_pfn,
+				 zone_end_pfn);
+	}

arch/x86/mm/highmem_32.c EXPORT_SYMBOL(kmap); · line 192

Quoted 10 lines
arch/x86/mm/highmem_32.c +10 -0
+	totalram_pages += totalhigh_pages;
+}
+#else
+static void __init set_highmem_pages_init(void)
+{
+	add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
+
+	totalram_pages += totalhigh_pages;
+}
+#endif /* CONFIG_NUMA */

Couldnt we just wrap the !NUMA case into the NUMA case and just have the NUMA function present, by making for_each_zone() a two-entries matter and making the second entry contain:

   zone->zone_start_pfn := highstart_pfn
   zone->spanned_pages := highend_pfn-highstart_pfn 
Quoted 7 lines
Quoted 5 lines

OK, I don't quite understand your suggestion here. The zones are set up completely at this stage so AFAICT, even for the UMA case, there should be a highmem zone there. So unless I am missing something here, I think we can get away with something as simple as the following.

ok, good - it is an easier cleanup than i hoped it would be :-)

s/hoped/thought

Ingo

#5 lore raw

[tip:x86/mm] x86: set_highmem_pages_init() cleanup, #2

In reply to Pekka Enberg
Commit-ID:  6298e719cf388f43b674f43799af467d3e4e5aa7
Gitweb:     http://git.kernel.org/tip/6298e719cf388f43b674f43799af467d3e4e5aa7
Author:     "Pekka Enberg" <[email protected]>
AuthorDate: Wed, 4 Mar 2009 10:16:07 +0200
Commit:     Ingo Molnar <[email protected]>
CommitDate: Wed, 4 Mar 2009 19:00:51 +0100

x86: set_highmem_pages_init() cleanup, #2

Impact: cleanup

The zones are set up at this stage so there's a highmem zone available even for the UMA case.

The only difference there is that for machines that have CONFIG_HIGHMEM enabled but don't have any highmem available, ->zone_start_pfn is zero whereas highstart_pfn is non-zero).

The field is left zeroed because of the !size test in free_area_init_core() but shouldn't be a problem because add_highpages_with_active_regions() handles empty ranges just fine.

LKML-Reference: <1236154567.29024.23.camel@penberg-laptop>

---
 arch/x86/mm/highmem_32.c |    9 ---------
 1 files changed, 0 insertions(+), 9 deletions(-)
arch/x86/mm/highmem_32.c +0 -9
index 00f127c..d117453 100644
@@ -158,7 +158,6 @@ EXPORT_SYMBOL(kunmap);
 EXPORT_SYMBOL(kmap_atomic);
 EXPORT_SYMBOL(kunmap_atomic);
 
-#ifdef CONFIG_NUMA
 void __init set_highmem_pages_init(void)
 {
 	struct zone *zone;
@@ -182,11 +181,3 @@ void __init set_highmem_pages_init(void)
 	}
 	totalram_pages += totalhigh_pages;
 }
-#else
-void __init set_highmem_pages_init(void)
-{
-	add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
-
-	totalram_pages += totalhigh_pages;
-}
-#endif /* CONFIG_NUMA */
#6 lore raw
In reply to Pekka Enberg
Commit-ID:  867c5b5292583b1e474cbbcb4c77f09bfca3903c
Gitweb:     http://git.kernel.org/tip/867c5b5292583b1e474cbbcb4c77f09bfca3903c
Author:     "Pekka Enberg" <[email protected]>
AuthorDate: Tue, 3 Mar 2009 14:10:12 +0200
Commit:     Ingo Molnar <[email protected]>
CommitDate: Tue, 3 Mar 2009 13:13:15 +0100

x86: set_highmem_pages_init() cleanup

Impact: cleanup

This patch moves set_highmem_pages_init() to arch/x86/mm/highmem_32.c.

The declaration of the function is kept in asm/numa_32.h because asm/highmem.h is included only if CONFIG_HIGHMEM is enabled so we can't put the empty static inline function there.

LKML-Reference: <1236082212.2675.24.camel@penberg-laptop>

---
 arch/x86/include/asm/numa_32.h |    6 +++++-
 arch/x86/mm/highmem_32.c       |   34 ++++++++++++++++++++++++++++++++++
 arch/x86/mm/init_32.c          |   12 ------------
 arch/x86/mm/numa_32.c          |   26 --------------------------
 4 files changed, 39 insertions(+), 39 deletions(-)
arch/x86/include/asm/numa_32.h +5 -1
index e9f5db7..a372290 100644
@@ -4,8 +4,12 @@
 extern int pxm_to_nid(int pxm);
 extern void numa_remove_cpu(int cpu);
 
-#ifdef CONFIG_NUMA
+#ifdef CONFIG_HIGHMEM
 extern void set_highmem_pages_init(void);
+#else
+static inline void set_highmem_pages_init(void)
+{
+}
 #endif
 
 #endif /* _ASM_X86_NUMA_32_H */
arch/x86/mm/highmem_32.c +34 -0
index bcc079c..13a823c 100644
@@ -1,5 +1,6 @@
 #include <linux/highmem.h>
 #include <linux/module.h>
+#include <linux/swap.h> /* for totalram_pages */
 
 void *kmap(struct page *page)
 {
@@ -156,3 +157,36 @@ EXPORT_SYMBOL(kmap);
 EXPORT_SYMBOL(kunmap);
 EXPORT_SYMBOL(kmap_atomic);
 EXPORT_SYMBOL(kunmap_atomic);
+
+#ifdef CONFIG_NUMA
+void __init set_highmem_pages_init(void)
+{
+	struct zone *zone;
+	int nid;
+
+	for_each_zone(zone) {
+		unsigned long zone_start_pfn, zone_end_pfn;
+
+		if (!is_highmem(zone))
+			continue;
+
+		zone_start_pfn = zone->zone_start_pfn;
+		zone_end_pfn = zone_start_pfn + zone->spanned_pages;
+
+		nid = zone_to_nid(zone);
+		printk(KERN_INFO "Initializing %s for node %d (%08lx:%08lx)\n",
+				zone->name, nid, zone_start_pfn, zone_end_pfn);
+
+		add_highpages_with_active_regions(nid, zone_start_pfn,
+				 zone_end_pfn);
+	}
+	totalram_pages += totalhigh_pages;
+}
+#else
+static void __init set_highmem_pages_init(void)
+{
+	add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
+
+	totalram_pages += totalhigh_pages;
+}
+#endif /* CONFIG_NUMA */
arch/x86/mm/init_32.c +0 -12
index cd8d673..0b087dc 100644
@@ -467,22 +467,10 @@ void __init add_highpages_with_active_regions(int nid, unsigned long start_pfn,
 	work_with_active_regions(nid, add_highpages_work_fn, &data);
 }
 
-#ifndef CONFIG_NUMA
-static void __init set_highmem_pages_init(void)
-{
-	add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
-
-	totalram_pages += totalhigh_pages;
-}
-#endif /* !CONFIG_NUMA */
-
 #else
 static inline void permanent_kmaps_init(pgd_t *pgd_base)
 {
 }
-static inline void set_highmem_pages_init(void)
-{
-}
 #endif /* CONFIG_HIGHMEM */
 
 void __init native_pagetable_setup_start(pgd_t *base)
arch/x86/mm/numa_32.c +0 -26
index d1f7439..a04092a 100644
@@ -423,32 +423,6 @@ void __init initmem_init(unsigned long start_pfn,
 	setup_bootmem_allocator();
 }
 
-void __init set_highmem_pages_init(void)
-{
-#ifdef CONFIG_HIGHMEM
-	struct zone *zone;
-	int nid;
-
-	for_each_zone(zone) {
-		unsigned long zone_start_pfn, zone_end_pfn;
-
-		if (!is_highmem(zone))
-			continue;
-
-		zone_start_pfn = zone->zone_start_pfn;
-		zone_end_pfn = zone_start_pfn + zone->spanned_pages;
-
-		nid = zone_to_nid(zone);
-		printk(KERN_INFO "Initializing %s for node %d (%08lx:%08lx)\n",
-				zone->name, nid, zone_start_pfn, zone_end_pfn);
-
-		add_highpages_with_active_regions(nid, zone_start_pfn,
-				 zone_end_pfn);
-	}
-	totalram_pages += totalhigh_pages;
-#endif
-}
-
 #ifdef CONFIG_MEMORY_HOTPLUG
 static int paddr_to_nid(u64 addr)
 {
#7 lore raw

[tip:x86/mm] x86: set_highmem_pages_init() cleanup, fix !CONFIG_NUMA && CONFIG_HIGHMEM=y

In reply to Pekka Enberg
Commit-ID:  03787ceed8f7bf06af29f3b213017d89f8e9423d
Gitweb:     http://git.kernel.org/tip/03787ceed8f7bf06af29f3b213017d89f8e9423d
Author:     "Ingo Molnar" <[email protected]>
AuthorDate: Tue, 3 Mar 2009 15:32:24 +0100
Commit:     Ingo Molnar <[email protected]>
CommitDate: Tue, 3 Mar 2009 15:32:24 +0100

x86: set_highmem_pages_init() cleanup, fix !CONFIG_NUMA && CONFIG_HIGHMEM=y

Impact: build fix

arch/x86/mm/highmem_32.c:187: error: static declaration of 'set_highmem_pages_init' follows non-static declaration arch/x86/include/asm/numa_32.h:8: error: previous declaration of 'set_highmem_pages_init' was here

LKML-Reference: <1236082212.2675.24.camel@penberg-laptop>

---
 arch/x86/mm/highmem_32.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/mm/highmem_32.c +1 -1
index 13a823c..00f127c 100644
@@ -183,7 +183,7 @@ void __init set_highmem_pages_init(void)
 	totalram_pages += totalhigh_pages;
 }
 #else
-static void __init set_highmem_pages_init(void)
+void __init set_highmem_pages_init(void)
 {
 	add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
 
#8 lore raw

Re: [tip:x86/mm] x86: set_highmem_pages_init() cleanup, fix !CONFIG_NUMA && CONFIG_HIGHMEM=y

Quoted 28 lines · Ingo Molnar
Commit-ID:  03787ceed8f7bf06af29f3b213017d89f8e9423d
Gitweb:     http://git.kernel.org/tip/03787ceed8f7bf06af29f3b213017d89f8e9423d
Author:     "Ingo Molnar" <[email protected]>
AuthorDate: Tue, 3 Mar 2009 15:32:24 +0100
Commit:     Ingo Molnar <[email protected]>
CommitDate: Tue, 3 Mar 2009 15:32:24 +0100

x86: set_highmem_pages_init() cleanup, fix !CONFIG_NUMA && CONFIG_HIGHMEM=y

Impact: build fix

arch/x86/mm/highmem_32.c:187: error: static declaration of 'set_highmem_pages_init' follows non-static declaration arch/x86/include/asm/numa_32.h:8: error: previous declaration of 'set_highmem_pages_init' was here

LKML-Reference: <1236082212.2675.24.camel@penberg-laptop>

---
 arch/x86/mm/highmem_32.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/mm/highmem_32.c +0 -0
index 13a823c..00f127c 100644

arch/x86/mm/highmem_32.c void __init set_highmem_pages_init(void) · line 189

Quoted 8 lines
arch/x86/mm/highmem_32.c +1 -1
@@ -183,7 +183,7 @@ void __init set_highmem_pages_init(void)
 	totalram_pages += totalhigh_pages;
 }
 #else
-static void __init set_highmem_pages_init(void)
+void __init set_highmem_pages_init(void)
 {
 	add_highpages_with_active_regions(0, highstart_pfn, highend_pfn);
 

I thought I tested that... The patch looks good. Thanks, Ingo!