Skip to contentSkip to conversation

simplify initialization of highmem pages

PATCH In review Jiang Liu 4 participants 17 messages Mar 10, 2013 – Mar 13, 2013

Subsystems (11)
lore
Share & tools
lore

Jiang Liu

author
#0 lore raw

v2 cover simplify initialization of highmem pages

The original goal of this patchset is to fix the bug reported by
https://bugzilla.kernel.org/show_bug.cgi?id=53501
Now it has also been expanded to reduce common code used by memory initializion.

This is the second part, which applies to the previous part at:
http://marc.info/?l=linux-mm&m=136289696323825&w=2

It introduces a helper function free_highmem_page() to free highmem pages into the buddy system when initializing mm subsystem. Introduction of free_highmem_page() is one step forward to clean up accesses and modificaitons of totalhigh_pages, totalram_pages and zone->managed_pages etc. I hope we could remove all references to totalhigh_pages from the arch/ subdirectory.

We have only tested these patchset on x86 platforms, and have done basic compliation tests using cross-compilers from ftp.kernel.org. That means some code may not pass compilation on some architectures. So any help to test this patchset are welcomed!

There are several other parts still under development:
Part3: refine code to manage totalram_pages, totalhigh_pages and

	zone->managed_pages

Part4: introduce helper functions to simplify mem_init() and remove the
global variable num_physpages.

Jiang Liu (10):
mm: introduce free_highmem_page() helper to free highmem pages into
buddy system
mm/ARM: use free_highmem_page() to free highmem pages into buddy
system
mm/FRV: use free_highmem_page() to free highmem pages into buddy
system
mm/metag: use free_highmem_page() to free highmem pages into buddy
system
mm/microblaze: use free_highmem_page() to free highmem pages into
buddy system
mm/MIPS: use free_highmem_page() to free highmem pages into buddy
system
mm/PPC: use free_highmem_page() to free highmem pages into buddy
system
mm/SPARC: use free_highmem_page() to free highmem pages into buddy
system
mm/um: use free_highmem_page() to free highmem pages into buddy
system
mm/x86: use free_highmem_page() to free highmem pages into buddy
system

 arch/arm/mm/init.c        |    7 ++-----
 arch/frv/mm/init.c        |    6 ++----
 arch/metag/mm/init.c      |   10 ++--------
 arch/microblaze/mm/init.c |    6 +-----
 arch/mips/mm/init.c       |    6 +-----
 arch/powerpc/mm/mem.c     |    6 +-----
 arch/sparc/mm/init_32.c   |   12 ++----------
 arch/um/kernel/mem.c      |   16 +++-------------
 arch/x86/mm/highmem_32.c  |    1 -
 arch/x86/mm/init_32.c     |   10 +---------
 include/linux/mm.h        |    7 +++++++
 mm/page_alloc.c           |    9 +++++++++
 12 files changed, 31 insertions(+), 65 deletions(-)
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#1 lore raw

PATCH v2 1/10 mm: introduce free_highmem_page() helper to free highmem pages into buddy system

Introduce helper function free_highmem_page(), which will be used by architectures with HIGHMEM enabled to free highmem pages into the buddy system.

Cc Andrew Morton <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Michel Lespinasse <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Konstantin Khlebnikov <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Marek Szyprowski <[email protected]>
Cc Michal Nazarewicz <[email protected]>
Cc Russell King <[email protected]>
Cc David Howells <[email protected]>
Cc James Hogan <[email protected]>
Cc Michal Simek <[email protected]>
Cc Ralf Baechle <[email protected]>
Cc David Daney <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Jeff Dike <[email protected]>
Cc Richard Weinberger <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
---
 include/linux/mm.h |    7 +++++++
 mm/page_alloc.c    |    9 +++++++++
 2 files changed, 16 insertions(+)
include/linux/mm.h +7 -0
index d75c14b..f2fb750 100644
@@ -1303,6 +1303,13 @@ extern void free_initmem(void);
  */
 extern unsigned long free_reserved_area(unsigned long start, unsigned long end,
 					int poison, char *s);
+#ifdef	CONFIG_HIGHMEM
+/*
+ * Free a highmem page into the buddy system, adjusting totalhigh_pages
+ * and totalram_pages.
+ */
+extern void free_highmem_page(struct page *page);
+#endif
 
 static inline void adjust_managed_page_count(struct page *page, long count)
 {
mm/page_alloc.c +9 -0
index 0fadb09..37bc8ab 100644
@@ -5133,6 +5133,15 @@ unsigned long free_reserved_area(unsigned long start, unsigned long end,
 	return pages;
 }
 
+#ifdef	CONFIG_HIGHMEM
+void free_highmem_page(struct page *page)
+{
+	__free_reserved_page(page);
+	totalram_pages++;
+	totalhigh_pages++;
+}
+#endif
+
 /**
  * set_dma_reserve - set the specified number of pages reserved in the first zone
  * @new_dma_reserve: The number of pages to mark reserved
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Reviewed-by on v2 1/10
#2 lore raw

Re: [PATCH v2, part2 01/10] mm: introduce free_highmem_page() helper to free highmem pages into buddy system

Quoted 5 lines · Jiang Liu

Introduce helper function free_highmem_page(), which will be used by architectures with HIGHMEM enabled to free highmem pages into the buddy system.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#3 lore raw

PATCH v2 2/10 mm/ARM: use free_highmem_page() to free highmem pages into buddy system

In reply to Jiang Liu

Use helper function free_highmem_page() to free highmem pages into the buddy system.

Cc Russell King <[email protected]>
Cc Linus Walleij <[email protected]>
cc Marek Szyprowski <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Cc linux-kernel at vger.kernel.org
---
 arch/arm/mm/init.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
arch/arm/mm/init.c +2 -5
index 40a5bc2..687a114 100644
@@ -519,10 +519,8 @@ static void __init free_unused_memmap(struct meminfo *mi)
 #ifdef CONFIG_HIGHMEM
 static inline void free_area_high(unsigned long pfn, unsigned long end)
 {
-	for (; pfn < end; pfn++) {
-		__free_reserved_page(pfn_to_page(pfn));
-		totalhigh_pages++;
-	}
+	for (; pfn < end; pfn++)
+		free_highmem_page(pfn_to_page(pfn));
 }
 #endif
 
@@ -571,7 +569,6 @@ static void __init free_highpages(void)
 		if (start < end)
 			free_area_high(start, end);
 	}
-	totalram_pages += totalhigh_pages;
 #endif
 }
 
Signature · 1 line
1.7.9.5
author
#4 lore raw

PATCH v2 3/10 mm/FRV: use free_highmem_page() to free highmem pages into buddy system

In reply to Jiang Liu

Use helper function free_highmem_page() to free highmem pages into the buddy system.

Also fix a bug that totalhigh_pages should be increased when freeing a highmem page into the buddy system.

Cc David Howells <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Geert Uytterhoeven <[email protected]>
---
 arch/frv/mm/init.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/frv/mm/init.c +2 -4
index 21b9290..dee354f 100644
@@ -131,10 +131,8 @@ void __init mem_init(void)
 			datapages++;
 
 #ifdef CONFIG_HIGHMEM
-	for (pfn = num_physpages - 1; pfn >= num_mappedpages; pfn--) {
-		__free_reserved_page(&mem_map[pfn]);
-		totalram_pages++;
-	}
+	for (pfn = num_physpages - 1; pfn >= num_mappedpages; pfn--)
+		free_highmem_page(&mem_map[pfn]);
 #endif
 
 	codek = ((unsigned long) &_etext - (unsigned long) &_stext) >> 10;
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#5 lore raw

PATCH v2 4/10 mm/metag: use free_highmem_page() to free highmem pages into buddy system

In reply to Jiang Liu

Use helper function free_highmem_page() to free highmem pages into the buddy system.

---
 arch/metag/mm/init.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
arch/metag/mm/init.c +2 -8
index c6784fb..d05b845 100644
@@ -380,14 +380,8 @@ void __init mem_init(void)
 
 #ifdef CONFIG_HIGHMEM
 	unsigned long tmp;
-	for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
-		struct page *page = pfn_to_page(tmp);
-		ClearPageReserved(page);
-		init_page_count(page);
-		__free_page(page);
-		totalhigh_pages++;
-	}
-	totalram_pages += totalhigh_pages;
+	for (tmp = highstart_pfn; tmp < highend_pfn; tmp++)
+		free_highmem_page(pfn_to_page(tmp));
 	num_physpages += totalhigh_pages;
 #endif /* CONFIG_HIGHMEM */
 
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#6 lore raw

PATCH v2 5/10 mm/microblaze: use free_highmem_page() to free highmem pages into buddy system

In reply to Jiang Liu

Use helper function free_highmem_page() to free highmem pages into the buddy system.

---
 arch/microblaze/mm/init.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
arch/microblaze/mm/init.c +1 -5
index 9be5302..4ec137d 100644
@@ -82,13 +82,9 @@ static unsigned long highmem_setup(void)
 		/* FIXME not sure about */
 		if (memblock_is_reserved(pfn << PAGE_SHIFT))
 			continue;
-		ClearPageReserved(page);
-		init_page_count(page);
-		__free_page(page);
-		totalhigh_pages++;
+		free_highmem_page(page);
 		reservedpages++;
 	}
-	totalram_pages += totalhigh_pages;
 	pr_info("High memory: %luk\n",
 					totalhigh_pages << (PAGE_SHIFT-10));
 
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#7 lore raw

PATCH v2 6/10 mm/MIPS: use free_highmem_page() to free highmem pages into buddy system

In reply to Jiang Liu

Use helper function free_highmem_page() to free highmem pages into the buddy system.

---
 arch/mips/mm/init.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
arch/mips/mm/init.c +1 -5
index 60f7c61..3d0346d 100644
@@ -393,12 +393,8 @@ void __init mem_init(void)
 			SetPageReserved(page);
 			continue;
 		}
-		ClearPageReserved(page);
-		init_page_count(page);
-		__free_page(page);
-		totalhigh_pages++;
+		free_highmem_page(page);
 	}
-	totalram_pages += totalhigh_pages;
 	num_physpages += totalhigh_pages;
 #endif
 
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#8 lore raw

PATCH v2 7/10 mm/PPC: use free_highmem_page() to free highmem pages into buddy system

In reply to Jiang Liu

Use helper function free_highmem_page() to free highmem pages into the buddy system.

Cc Benjamin Herrenschmidt <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Jiang Liu <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Alexander Graf <[email protected]>
Cc "Suzuki K. Poulose" <[email protected]>
---
 arch/powerpc/mm/mem.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
arch/powerpc/mm/mem.c +1 -5
index c756713..68f51d0 100644
@@ -352,13 +352,9 @@ void __init mem_init(void)
 			struct page *page = pfn_to_page(pfn);
 			if (memblock_is_reserved(paddr))
 				continue;
-			ClearPageReserved(page);
-			init_page_count(page);
-			__free_page(page);
-			totalhigh_pages++;
+			free_higmem_page(page);
 			reservedpages--;
 		}
-		totalram_pages += totalhigh_pages;
 		printk(KERN_DEBUG "High memory: %luk\n",
 		       totalhigh_pages << (PAGE_SHIFT-10));
 	}
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#9 lore raw

PATCH v2 8/10 mm/SPARC: use free_highmem_page() to free highmem pages into buddy system

In reply to Jiang Liu

Use helper function free_highmem_page() to free highmem pages into the buddy system.

Cc "David S. Miller" <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Andrew Morton <[email protected]>
---
 arch/sparc/mm/init_32.c |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)
arch/sparc/mm/init_32.c +2 -10
index 13d6fee..6a7eb68 100644
@@ -282,14 +282,8 @@ static void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
 	printk("mapping high region %08lx - %08lx\n", start_pfn, end_pfn);
 #endif
 
-	for (tmp = start_pfn; tmp < end_pfn; tmp++) {
-		struct page *page = pfn_to_page(tmp);
-
-		ClearPageReserved(page);
-		init_page_count(page);
-		__free_page(page);
-		totalhigh_pages++;
-	}
+	for (tmp = start_pfn; tmp < end_pfn; tmp++)
+		free_higmem_page(pfn_to_page(tmp));
 }
 
 void __init mem_init(void)
@@ -347,8 +341,6 @@ void __init mem_init(void)
 		map_high_region(start_pfn, end_pfn);
 	}
 	
-	totalram_pages += totalhigh_pages;
-
 	codepages = (((unsigned long) &_etext) - ((unsigned long)&_start));
 	codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT;
 	datapages = (((unsigned long) &_edata) - ((unsigned long)&_etext));
Signature · 1 line
1.7.9.5
maintainer
#10 lore raw

Re: [PATCH v2, part2 08/10] mm/SPARC: use free_highmem_page() to free highmem pages into buddy system

Quoted 12 lines · On Sun, 10 Mar 2013 16:01:08 +0800 Jiang Liu <[email protected]> wrote:

Use helper function free_highmem_page() to free highmem pages into the buddy system.

...

arch/sparc/mm/init_32.c +0 -1
@@ -282,14 +282,8 @@ static void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
 	printk("mapping high region %08lx - %08lx\n", start_pfn, end_pfn);
 #endif
 
-	for (tmp = start_pfn; tmp < end_pfn; tmp++) {

arch/sparc/mm/init_32.c static void map_high_region(unsigned long start_pfn, unsigned long end_pfn) · line 287

Quoted 10 lines
arch/sparc/mm/init_32.c +2 -7
-		struct page *page = pfn_to_page(tmp);
-
-		ClearPageReserved(page);
-		init_page_count(page);
-		__free_page(page);
-		totalhigh_pages++;
-	}
+	for (tmp = start_pfn; tmp < end_pfn; tmp++)
+		free_higmem_page(pfn_to_page(tmp));
 }

This code isn't inside #ifdef CONFIG_HIGHMEM, but afaict that's OK because CONFIG_HIGHMEM=n isn't possible on sparc32.

This patch and one other mistyped "free_highmem_page". I got lazy and edited those patches in-place.

Acked-by
#11 lore raw

Re: [PATCH v2, part2 08/10] mm/SPARC: use free_highmem_page() to free highmem pages into buddy system

Quoted 13 lines · Andrew Morton
Quoted 11 lines · On Sun, 10 Mar 2013 16:01:08 +0800 Jiang Liu <[email protected]> wrote:

Use helper function free_highmem_page() to free highmem pages into the buddy system.

...

arch/sparc/mm/init_32.c +0 -0
@@ -282,14 +282,8 @@ static void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
 	printk("mapping high region %08lx - %08lx\n", start_pfn, end_pfn);
 #endif
 
Quoted 14 lines

arch/sparc/mm/init_32.c static void map_high_region(unsigned long start_pfn, unsigned long end_pfn) · line 287

Quoted 11 lines
arch/sparc/mm/init_32.c +2 -8
-	for (tmp = start_pfn; tmp < end_pfn; tmp++) {
-		struct page *page = pfn_to_page(tmp);
-
-		ClearPageReserved(page);
-		init_page_count(page);
-		__free_page(page);
-		totalhigh_pages++;
-	}
+	for (tmp = start_pfn; tmp < end_pfn; tmp++)
+		free_higmem_page(pfn_to_page(tmp));
 }

This code isn't inside #ifdef CONFIG_HIGHMEM, but afaict that's OK because CONFIG_HIGHMEM=n isn't possible on sparc32.

Correct - from arch/sparc/Kconfig

config HIGHMEM
bool
default y if SPARC32

Quoted 2 lines

This patch and one other mistyped "free_highmem_page". I got lazy and edited those patches in-place.

Good spot!

You can add my:

Sam

author
#12 lore raw

Re: [PATCH v2, part2 08/10] mm/SPARC: use free_highmem_page() to free highmem pages into buddy system

In reply to Andrew Morton
Quoted 28 lines · Andrew Morton
Quoted 12 lines · On Sun, 10 Mar 2013 16:01:08 +0800 Jiang Liu <[email protected]> wrote:

Use helper function free_highmem_page() to free highmem pages into the buddy system.

...

arch/sparc/mm/init_32.c +0 -1
@@ -282,14 +282,8 @@ static void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
 	printk("mapping high region %08lx - %08lx\n", start_pfn, end_pfn);
 #endif
 
-	for (tmp = start_pfn; tmp < end_pfn; tmp++) {

arch/sparc/mm/init_32.c static void map_high_region(unsigned long start_pfn, unsigned long end_pfn) · line 287

Quoted 10 lines
arch/sparc/mm/init_32.c +2 -7
-		struct page *page = pfn_to_page(tmp);
-
-		ClearPageReserved(page);
-		init_page_count(page);
-		__free_page(page);
-		totalhigh_pages++;
-	}
+	for (tmp = start_pfn; tmp < end_pfn; tmp++)
+		free_higmem_page(pfn_to_page(tmp));
 }

This code isn't inside #ifdef CONFIG_HIGHMEM, but afaict that's OK because CONFIG_HIGHMEM=n isn't possible on sparc32.

Quoted 3 lines

This patch and one other mistyped "free_highmem_page". I got lazy and edited those patches in-place.

Hi Andrew,
Great thanks for fixing them!
Gerry

author
#13 lore raw

PATCH v2 9/10 mm/um: use free_highmem_page() to free highmem pages into buddy system

In reply to Jiang Liu

Use helper function free_highmem_page() to free highmem pages into the buddy system.

---
 arch/um/kernel/mem.c |   16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
arch/um/kernel/mem.c +3 -13
index d5ac802..9df292b 100644
@@ -42,17 +42,12 @@ static unsigned long brk_end;
 static void setup_highmem(unsigned long highmem_start,
 			  unsigned long highmem_len)
 {
-	struct page *page;
 	unsigned long highmem_pfn;
 	int i;
 
 	highmem_pfn = __pa(highmem_start) >> PAGE_SHIFT;
-	for (i = 0; i < highmem_len >> PAGE_SHIFT; i++) {
-		page = &mem_map[highmem_pfn + i];
-		ClearPageReserved(page);
-		init_page_count(page);
-		__free_page(page);
-	}
+	for (i = 0; i < highmem_len >> PAGE_SHIFT; i++)
+		free_highmem_page(&mem_map[highmem_pfn + i]);
 }
 #endif
 
@@ -73,18 +68,13 @@ void __init mem_init(void)
 	totalram_pages = free_all_bootmem();
 	max_low_pfn = totalram_pages;
 #ifdef CONFIG_HIGHMEM
-	totalhigh_pages = highmem >> PAGE_SHIFT;
-	totalram_pages += totalhigh_pages;
+	setup_highmem(end_iomem, highmem);
 #endif
 	num_physpages = totalram_pages;
 	max_pfn = totalram_pages;
 	printk(KERN_INFO "Memory: %luk available\n",
 	       nr_free_pages() << (PAGE_SHIFT-10));
 	kmalloc_ok = 1;
-
-#ifdef CONFIG_HIGHMEM
-	setup_highmem(end_iomem, highmem);
-#endif
 }
 
 /*
Signature · 1 line
1.7.9.5
author
#14 lore raw

PATCH v2 10/10 mm/x86: use free_highmem_page() to free highmem pages into buddy system

In reply to Jiang Liu

Use helper function free_highmem_page() to free highmem pages into the buddy system.

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Cong Wang <[email protected]>
Cc Yinghai Lu <[email protected]>
Cc Attilio Rao <[email protected]>
---
 arch/x86/mm/highmem_32.c |    1 -
 arch/x86/mm/init_32.c    |   10 +---------
 2 files changed, 1 insertion(+), 10 deletions(-)
arch/x86/mm/highmem_32.c +0 -1
index 6f31ee5..252b8f5 100644
@@ -137,5 +137,4 @@ void __init set_highmem_pages_init(void)
 		add_highpages_with_active_regions(nid, zone_start_pfn,
 				 zone_end_pfn);
 	}
-	totalram_pages += totalhigh_pages;
 }
arch/x86/mm/init_32.c +1 -9
index 2d19001..3ac7e31 100644
@@ -427,14 +427,6 @@ static void __init permanent_kmaps_init(pgd_t *pgd_base)
 	pkmap_page_table = pte;
 }
 
-static void __init add_one_highpage_init(struct page *page)
-{
-	ClearPageReserved(page);
-	init_page_count(page);
-	__free_page(page);
-	totalhigh_pages++;
-}
-
 void __init add_highpages_with_active_regions(int nid,
 			 unsigned long start_pfn, unsigned long end_pfn)
 {
@@ -448,7 +440,7 @@ void __init add_highpages_with_active_regions(int nid,
 					      start_pfn, end_pfn);
 		for ( ; pfn < e_pfn; pfn++)
 			if (pfn_valid(pfn))
-				add_one_highpage_init(pfn_to_page(pfn));
+				free_highmem_page(pfn_to_page(pfn));
 	}
 }
 #else
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#15 lore raw

Re: [PATCH v2, part2 10/10] mm/x86: use free_highmem_page() to free highmem pages into buddy system

Quoted 14 lines · Jiang Liu

Use helper function free_highmem_page() to free highmem pages into the buddy system.

---
 arch/x86/mm/highmem_32.c |    1 -
 arch/x86/mm/init_32.c    |   10 +---------
 2 files changed, 1 insertion(+), 10 deletions(-)
arch/x86/mm/highmem_32.c +0 -0
index 6f31ee5..252b8f5 100644

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

Quoted 4 lines
arch/x86/mm/highmem_32.c +0 -1
@@ -137,5 +137,4 @@ void __init set_highmem_pages_init(void)
                add_highpages_with_active_regions(nid, zone_start_pfn,
                                 zone_end_pfn);
        }
-       totalram_pages += totalhigh_pages;

Hmm? I haven't looked at what totalram_pages is used for but could you explain why this change is safe?

Quoted 32 lines
arch/x86/mm/highmem_32.c +0 -0
 }
arch/x86/mm/init_32.c +1 -10
index 2d19001..3ac7e31 100644
@@ -427,14 +427,6 @@ static void __init permanent_kmaps_init(pgd_t *pgd_base)
        pkmap_page_table = pte;
 }
 
-static void __init add_one_highpage_init(struct page *page)
-{
-       ClearPageReserved(page);
-       init_page_count(page);
-       __free_page(page);
-       totalhigh_pages++;
-}
-
 void __init add_highpages_with_active_regions(int nid,
                         unsigned long start_pfn, unsigned long end_pfn)
 {
@@ -448,7 +440,7 @@ void __init add_highpages_with_active_regions(int nid,
                                              start_pfn, end_pfn);
                for ( ; pfn < e_pfn; pfn++)
                        if (pfn_valid(pfn))
-                               add_one_highpage_init(pfn_to_page(pfn));
+                               free_highmem_page(pfn_to_page(pfn));
        }
 }
 #else
--

1.7.9.5

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Reviewed-by
#16 lore raw

Re: [PATCH v2, part2 10/10] mm/x86: use free_highmem_page() to free highmem pages into buddy system

Quoted 10 lines · Pekka Enberg
Quoted 9 lines · Jiang Liu

Use helper function free_highmem_page() to free highmem pages into the buddy system.

---
 arch/x86/mm/highmem_32.c |    1 -
 arch/x86/mm/init_32.c    |   10 +---------
 2 files changed, 1 insertion(+), 10 deletions(-)
Quoted 12 lines

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

Quoted 9 lines
arch/x86/mm/highmem_32.c +0 -1
index 6f31ee5..252b8f5 100644
@@ -137,5 +137,4 @@ void __init set_highmem_pages_init(void)
                add_highpages_with_active_regions(nid, zone_start_pfn,
                                 zone_end_pfn);
        }
-       totalram_pages += totalhigh_pages;

Hmm? I haven't looked at what totalram_pages is used for but could you explain why this change is safe?

Never mind, I should have read the patchset more carefully:

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>