linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE()
@ 2013-04-13 15:36 Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 01/19] mm: introduce accessor function set_max_mapnr() Jiang Liu
                   ` (19 more replies)
  0 siblings, 20 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel

Commit 600cc5b7f6 "mm: Kill NO_BOOTMEM version free_all_bootmem_node()"
has kill free_all_bootmem_node() for NO_BOOTMEM.

Currently the usage pattern for free_all_bootmem_node() is like:
for_each_online_pgdat(pgdat)
	free_all_bootmem_node(pgdat);

It's equivalent to free_all_bootmem(), so this patchset goes one
step further to kill free_all_bootmem_node() for BOOTMEM too.

This patchset also tries to clean up code and comments related to
VALID_PAGE() because it has been removed from kernel long time ago.

Patch 1-11:
	Kill free_all_bootmem_node()
Patch 12-16:
	Clean up code and comments related to VALID_PAGE()
Patch 17:
	Fix a minor build warning for m68k
Patch 18:
	merge Alpha's mem_init() for UMA and NUMA.
Patch 19:
	call register_page_bootmem_info_node() from mm core

This patch is based on patchset at
http://marc.info/?l=linux-mm&m=136525931917910&w=2

Jiang Liu (19):
  mm: introduce accessor function set_max_mapnr()
  mm/AVR32: prepare for killing free_all_bootmem_node()
  mm/IA64: prepare for killing free_all_bootmem_node()
  mm/m32r: prepare for killing free_all_bootmem_node()
  mm/m68k: prepare for killing free_all_bootmem_node()
  mm/metag: prepare for killing free_all_bootmem_node()
  mm/MIPS: prepare for killing free_all_bootmem_node()
  mm/PARISC: prepare for killing free_all_bootmem_node()
  mm/PPC: prepare for killing free_all_bootmem_node()
  mm/SH: prepare for killing free_all_bootmem_node()
  mm: kill free_all_bootmem_node()
  mm/ALPHA: clean up unused VALID_PAGE()
  mm/CRIS: clean up unused VALID_PAGE()
  mm/microblaze: clean up unused VALID_PAGE()
  mm/ARM: fix stale comment about VALID_PAGE()
  mm/unicore32: fix stale comment about VALID_PAGE()
  mm/m68k: fix build warning of unused variable
  mm/alpha: unify mem_init() for both UMA and NUMA architectures
  mm: call register_page_bootmem_info_node() from mm core

 arch/alpha/include/asm/mmzone.h     |    2 --
 arch/alpha/mm/init.c                |    7 ++-----
 arch/alpha/mm/numa.c                |   10 ----------
 arch/arm/include/asm/memory.h       |    6 ------
 arch/avr32/mm/init.c                |   21 +++++----------------
 arch/cris/include/asm/page.h        |    1 -
 arch/ia64/mm/init.c                 |    9 ++-------
 arch/m32r/mm/init.c                 |   17 ++++-------------
 arch/m68k/mm/init.c                 |   15 ++++++++-------
 arch/metag/mm/init.c                |   14 ++------------
 arch/microblaze/include/asm/page.h  |    1 -
 arch/mips/sgi-ip27/ip27-memory.c    |   12 +-----------
 arch/parisc/mm/init.c               |   12 +-----------
 arch/powerpc/mm/mem.c               |   16 +---------------
 arch/sh/mm/init.c                   |   16 ++++------------
 arch/sparc/mm/init_64.c             |   12 ------------
 arch/unicore32/include/asm/memory.h |    6 ------
 arch/x86/mm/init_64.c               |   12 ------------
 include/linux/bootmem.h             |    1 -
 include/linux/mm.h                  |    9 ++++++++-
 mm/bootmem.c                        |   24 ++++++------------------
 mm/nobootmem.c                      |    6 ++++++
 22 files changed, 50 insertions(+), 179 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 01/19] mm: introduce accessor function set_max_mapnr()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 02/19] mm/AVR32: prepare for killing free_all_bootmem_node() Jiang Liu
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel

Introduce accessor function set_max_mapnr() to set global variable
max_mapnr.

Also unify condition compilation for max_mapnr with
CONFIG_NEED_MULTIPLE_NODES instead of CONFIG_DISCONTIGMEM.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
---
 include/linux/mm.h |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index f9f9f3c..497ebaf 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -25,8 +25,15 @@ struct file_ra_state;
 struct user_struct;
 struct writeback_control;
 
-#ifndef CONFIG_DISCONTIGMEM          /* Don't use mapnrs, do it properly */
+#ifndef CONFIG_NEED_MULTIPLE_NODES	/* Don't use mapnrs, do it properly */
 extern unsigned long max_mapnr;
+
+static inline void set_max_mapnr(unsigned long limit)
+{
+	max_mapnr = limit;
+}
+#else
+static inline void set_max_mapnr(unsigned long limit) { }
 #endif
 
 extern unsigned long totalram_pages;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 02/19] mm/AVR32: prepare for killing free_all_bootmem_node()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 01/19] mm: introduce accessor function set_max_mapnr() Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 03/19] mm/IA64: " Jiang Liu
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel,
	Haavard Skinnemoen, Hans-Christian Egtvedt

Prepare for killing free_all_bootmem_node() by using
free_all_bootmem() instead.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: linux-kernel@vger.kernel.org
---
 arch/avr32/mm/init.c |   21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index c1706a0..b25aba3 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -103,23 +103,12 @@ void __init mem_init(void)
 	pg_data_t *pgdat;
 
 	high_memory = NULL;
+	for_each_online_pgdat(pgdat)
+		high_memory = max_t(void *, high_memory,
+			(void *)__va(pgdat_end_pfn(pgdat) << PAGE_SHIFT));
 
-	/* this will put all low memory onto the freelists */
-	for_each_online_pgdat(pgdat) {
-		void *node_high_memory;
-
-		if (pgdat->node_spanned_pages != 0)
-			free_all_bootmem_node(pgdat);
-
-		node_high_memory = (void *)((pgdat->node_start_pfn
-					     + pgdat->node_spanned_pages)
-					    << PAGE_SHIFT);
-		if (node_high_memory > high_memory)
-			high_memory = node_high_memory;
-	}
-
-	max_mapnr = MAP_NR(high_memory);
-
+	set_max_mapnr(MAP_NR(high_memory));
+	free_all_bootmem();
 	mem_init_print_info(NULL);
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 03/19] mm/IA64: prepare for killing free_all_bootmem_node()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 01/19] mm: introduce accessor function set_max_mapnr() Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 02/19] mm/AVR32: prepare for killing free_all_bootmem_node() Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 04/19] mm/m32r: " Jiang Liu
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel, Tony Luck,
	Fenghua Yu, Tang Chen, linux-ia64

Prepare for killing free_all_bootmem_node() by using
free_all_bootmem().

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: linux-ia64@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 arch/ia64/mm/init.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index d4382dc..26eeb74 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -584,7 +584,6 @@ __setup("nolwsys", nolwsys_setup);
 void __init
 mem_init (void)
 {
-	pg_data_t *pgdat;
 	int i;
 
 	BUG_ON(PTRS_PER_PGD * sizeof(pgd_t) != PAGE_SIZE);
@@ -602,15 +601,11 @@ mem_init (void)
 
 #ifdef CONFIG_FLATMEM
 	BUG_ON(!mem_map);
-	max_mapnr = max_low_pfn;
 #endif
 
+	set_max_mapnr(max_low_pfn);
 	high_memory = __va(max_low_pfn * PAGE_SIZE);
-
-	for_each_online_pgdat(pgdat)
-		if (pgdat->bdata->node_bootmem_map)
-			free_all_bootmem_node(pgdat);
-
+	free_all_bootmem();
 	mem_init_print_info(NULL);
 
 	/*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 04/19] mm/m32r: prepare for killing free_all_bootmem_node()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (2 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 03/19] mm/IA64: " Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 05/19] mm/m68k: " Jiang Liu
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel, Hirokazu Takata,
	linux-m32r, linux-m32r-ja

Prepare for killing free_all_bootmem_node() by using
free_all_bootmem().

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: linux-m32r@ml.linux-m32r.org
Cc: linux-m32r-ja@ml.linux-m32r.org
Cc: linux-kernel@vger.kernel.org
---
 arch/m32r/mm/init.c |   17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c
index 9c94839..3113c85 100644
--- a/arch/m32r/mm/init.c
+++ b/arch/m32r/mm/init.c
@@ -111,28 +111,19 @@ void __init paging_init(void)
  *======================================================================*/
 void __init mem_init(void)
 {
-	int nid;
 #ifndef CONFIG_MMU
 	extern unsigned long memory_end;
-#endif
 
-#ifndef CONFIG_DISCONTIGMEM
-	max_mapnr = get_num_physpages();
-#endif	/* CONFIG_DISCONTIGMEM */
-
-#ifdef CONFIG_MMU
-	high_memory = (void *)__va(PFN_PHYS(MAX_LOW_PFN(0)));
-#else
 	high_memory = (void *)(memory_end & PAGE_MASK);
+#else
+	high_memory = (void *)__va(PFN_PHYS(MAX_LOW_PFN(0)));
 #endif /* CONFIG_MMU */
 
 	/* clear the zero-page */
 	memset(empty_zero_page, 0, PAGE_SIZE);
 
-	/* this will put all low memory onto the freelists */
-	for_each_online_node(nid)
-		free_all_bootmem_node(NODE_DATA(nid));
-
+	set_max_mapnr(get_num_physpages());
+	free_all_bootmem();
 	mem_init_print_info(NULL);
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 05/19] mm/m68k: prepare for killing free_all_bootmem_node()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (3 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 04/19] mm/m32r: " Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 06/19] mm/metag: " Jiang Liu
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel,
	Geert Uytterhoeven, Greg Ungerer, linux-m68k

Prepare for killing free_all_bootmem_node() by using
free_all_bootmem().

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg Ungerer <gerg@uclinux.org>
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-kernel@vger.kernel.org
---
 arch/m68k/mm/init.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 0723141..20d0ae2 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -148,12 +148,10 @@ void __init print_memmap(void)
 
 void __init mem_init(void)
 {
-	pg_data_t *pgdat;
 	int i;
 
 	/* this will put all memory onto the freelists */
-	for_each_online_pgdat(pgdat)
-		free_all_bootmem_node(pgdat);
+	free_all_bootmem();
 
 #if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
 	/* insert pointer tables allocated so far into the tablelist */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 06/19] mm/metag: prepare for killing free_all_bootmem_node()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (4 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 05/19] mm/m68k: " Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 07/19] mm/MIPS: " Jiang Liu
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel, James Hogan

Prepare for killing free_all_bootmem_node() by using
free_all_bootmem().

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: linux-kernel@vger.kernel.org
---
 arch/metag/mm/init.c |   14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c
index e00586f..096d022 100644
--- a/arch/metag/mm/init.c
+++ b/arch/metag/mm/init.c
@@ -376,31 +376,21 @@ void __init paging_init(unsigned long mem_end)
 
 void __init mem_init(void)
 {
-	int nid;
-
 #ifdef CONFIG_HIGHMEM
 	unsigned long tmp;
 
 	/*
 	 * Explicitly reset zone->managed_pages because highmem pages are
-	 * freed before calling free_all_bootmem_node();
+	 * freed before calling free_all_bootmem();
 	 */
 	reset_all_zones_managed_pages();
 	for (tmp = highstart_pfn; tmp < highend_pfn; tmp++)
 		free_highmem_page(pfn_to_page(tmp));
 #endif /* CONFIG_HIGHMEM */
 
-	for_each_online_node(nid) {
-		pg_data_t *pgdat = NODE_DATA(nid);
-
-		if (pgdat->node_spanned_pages)
-			free_all_bootmem_node(pgdat);
-	}
-
+	free_all_bootmem();
 	mem_init_print_info(NULL);
 	show_mem(0);
-
-	return;
 }
 
 void free_initmem(void)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 07/19] mm/MIPS: prepare for killing free_all_bootmem_node()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (5 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 06/19] mm/metag: " Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 08/19] mm/PARISC: " Jiang Liu
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel, Ralf Baechle,
	linux-mips

Prepare for killing free_all_bootmem_node() by using
free_all_bootmem().

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
---
 arch/mips/sgi-ip27/ip27-memory.c |   12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index d074680..0ebea6f 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -477,18 +477,8 @@ void __init paging_init(void)
 
 void __init mem_init(void)
 {
-	unsigned node;
-
 	high_memory = (void *) __va(get_num_physpages() << PAGE_SHIFT);
-
-	for_each_online_node(node) {
-		/*
-		 * This will free up the bootmem, ie, slot 0 memory.
-		 */
-		free_all_bootmem_node(NODE_DATA(node));
-	}
-
+	free_all_bootmem();
 	setup_zero_pages();	/* This comes from node 0 */
-
 	mem_init_print_info(NULL);
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 08/19] mm/PARISC: prepare for killing free_all_bootmem_node()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (6 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 07/19] mm/MIPS: " Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 09/19] mm/PPC: " Jiang Liu
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel,
	James E.J. Bottomley, Helge Deller, linux-parisc

Prepare for killing free_all_bootmem_node() by using
free_all_bootmem().

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: David Rientjes <rientjes@google.com>
Cc: linux-parisc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 arch/parisc/mm/init.c |   12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index f80c175..ab76b84 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -585,18 +585,8 @@ void __init mem_init(void)
 			> BITS_PER_LONG);
 
 	high_memory = __va((max_pfn << PAGE_SHIFT));
-
-#ifndef CONFIG_DISCONTIGMEM
-	max_mapnr = page_to_pfn(virt_to_page(high_memory - 1)) + 1;
+	set_max_mapnr(page_to_pfn(virt_to_page(high_memory - 1)) + 1);
 	free_all_bootmem();
-#else
-	{
-		int i;
-
-		for (i = 0; i < npmem_ranges; i++)
-			free_all_bootmem_node(NODE_DATA(i));
-	}
-#endif
 
 #ifdef CONFIG_PA11
 	if (hppa_dma_ops == &pcxl_dma_ops) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 09/19] mm/PPC: prepare for killing free_all_bootmem_node()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (7 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 08/19] mm/PARISC: " Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 10/19] mm/SH: " Jiang Liu
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel,
	Benjamin Herrenschmidt, Paul Mackerras, Alexander Graf,
	Suzuki K. Poulose, linuxppc-dev

Prepare for killing free_all_bootmem_node() by using
free_all_bootmem().

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Alexander Graf <agraf@suse.de>
Cc: "Suzuki K. Poulose" <suzuki@in.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
---
 arch/powerpc/mm/mem.c |   16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 07663de..22e46db 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -305,22 +305,8 @@ void __init mem_init(void)
 #endif
 
 	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
-
-#ifdef CONFIG_NEED_MULTIPLE_NODES
-	{
-		pg_data_t *pgdat;
-
-		for_each_online_pgdat(pgdat)
-			if (pgdat->node_spanned_pages != 0) {
-				printk("freeing bootmem node %d\n",
-					pgdat->node_id);
-				free_all_bootmem_node(pgdat);
-			}
-	}
-#else
-	max_mapnr = max_pfn;
+	set_max_mapnr(max_pfn);
 	free_all_bootmem();
-#endif
 
 #ifdef CONFIG_HIGHMEM
 	{
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 10/19] mm/SH: prepare for killing free_all_bootmem_node()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (8 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 09/19] mm/PPC: " Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 11/19] mm: kill free_all_bootmem_node() Jiang Liu
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel, Paul Mundt,
	Tang Chen, linux-sh

Prepare for killing free_all_bootmem_node() by using
free_all_bootmem().

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: linux-sh@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 arch/sh/mm/init.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 3826596..485c858 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -412,19 +412,11 @@ void __init mem_init(void)
 	iommu_init();
 
 	high_memory = NULL;
+	for_each_online_pgdat(pgdat)
+		high_memory = max_t(void *, high_memory,
+			(void *)__va(pgdat_end_pfn(pgdat) << PAGE_SHIFT));
 
-	for_each_online_pgdat(pgdat) {
-		void *node_high_memory;
-
-		if (pgdat->node_spanned_pages)
-			free_all_bootmem_node(pgdat);
-
-		node_high_memory = (void *)__va((pgdat->node_start_pfn +
-						 pgdat->node_spanned_pages) <<
-						 PAGE_SHIFT);
-		if (node_high_memory > high_memory)
-			high_memory = node_high_memory;
-	}
+	free_all_bootmem();
 
 	/* Set this up early, so we can take care of the zero page */
 	cpu_cache_init();
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 11/19] mm: kill free_all_bootmem_node()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (9 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 10/19] mm/SH: " Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 12/19] mm/ALPHA: clean up unused VALID_PAGE() Jiang Liu
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel, Johannes Weiner,
	David S. Miller, Tejun Heo

Now nobody makes use of free_all_bootmem_node(), kill it.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
---
 include/linux/bootmem.h |    1 -
 mm/bootmem.c            |   18 ------------------
 2 files changed, 19 deletions(-)

diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index b585f57..a8866c5 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -45,7 +45,6 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat,
 extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
 
 extern unsigned long free_low_memory_core_early(int nodeid);
-extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
 extern unsigned long free_all_bootmem(void);
 extern void reset_all_zones_managed_pages(void);
 
diff --git a/mm/bootmem.c b/mm/bootmem.c
index a19404b..fab8f63 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -265,24 +265,6 @@ void __init reset_all_zones_managed_pages(void)
 }
 
 /**
- * free_all_bootmem_node - release a node's free pages to the buddy allocator
- * @pgdat: node to be released
- *
- * Returns the number of pages actually released.
- */
-unsigned long __init free_all_bootmem_node(pg_data_t *pgdat)
-{
-	unsigned long pages;
-
-	register_page_bootmem_info_node(pgdat);
-	reset_node_managed_pages(pgdat);
-	pages = free_all_bootmem_core(pgdat->bdata);
-	totalram_pages += pages;
-
-	return pages;
-}
-
-/**
  * free_all_bootmem - release free pages to the buddy allocator
  *
  * Returns the number of pages actually released.
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 12/19] mm/ALPHA: clean up unused VALID_PAGE()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (10 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 11/19] mm: kill free_all_bootmem_node() Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 13/19] mm/CRIS: " Jiang Liu
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel

VALID_PAGE() has been removed from kernel long time ago, so clean up it.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
---
 arch/alpha/include/asm/mmzone.h |    2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/alpha/include/asm/mmzone.h b/arch/alpha/include/asm/mmzone.h
index c5b5d6b..14ce27b 100644
--- a/arch/alpha/include/asm/mmzone.h
+++ b/arch/alpha/include/asm/mmzone.h
@@ -71,8 +71,6 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)
 
 #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
 
-#define VALID_PAGE(page)	(((page) - mem_map) < max_mapnr)
-
 #define pmd_page(pmd)		(pfn_to_page(pmd_val(pmd) >> 32))
 #define pgd_page(pgd)		(pfn_to_page(pgd_val(pgd) >> 32))
 #define pte_pfn(pte)		(pte_val(pte) >> 32)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 13/19] mm/CRIS: clean up unused VALID_PAGE()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (11 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 12/19] mm/ALPHA: clean up unused VALID_PAGE() Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-15 13:14   ` Jesper Nilsson
  2013-04-13 15:36 ` [RFC PATCH v1 14/19] mm/microblaze: " Jiang Liu
                   ` (6 subsequent siblings)
  19 siblings, 1 reply; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel, Mikael Starvik,
	Jesper Nilsson, linux-cris-kernel

VALID_PAGE() has been removed from kernel long time ago, so clean up it.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: linux-cris-kernel@axis.com
Cc: linux-kernel@vger.kernel.org
---
 arch/cris/include/asm/page.h |    1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/cris/include/asm/page.h b/arch/cris/include/asm/page.h
index be45ee3..dfc53f9 100644
--- a/arch/cris/include/asm/page.h
+++ b/arch/cris/include/asm/page.h
@@ -51,7 +51,6 @@ typedef struct page *pgtable_t;
  */ 
 
 #define virt_to_page(kaddr)    (mem_map + (((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT))
-#define VALID_PAGE(page)       (((page) - mem_map) < max_mapnr)
 #define virt_addr_valid(kaddr)	pfn_valid((unsigned)(kaddr) >> PAGE_SHIFT)
 
 /* convert a page (based on mem_map and forward) to a physical address
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 14/19] mm/microblaze: clean up unused VALID_PAGE()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (12 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 13/19] mm/CRIS: " Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 15/19] mm/ARM: fix stale comment about VALID_PAGE() Jiang Liu
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel, Michal Simek,
	microblaze-uclinux

VALID_PAGE() has been removed from kernel long time ago, so clean up it.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
Cc: linux-kernel@vger.kernel.org
---
 arch/microblaze/include/asm/page.h |    1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h
index 85a5ae8..fd85087 100644
--- a/arch/microblaze/include/asm/page.h
+++ b/arch/microblaze/include/asm/page.h
@@ -168,7 +168,6 @@ extern int page_is_ram(unsigned long pfn);
 #  else /* CONFIG_MMU */
 #  define ARCH_PFN_OFFSET	(memory_start >> PAGE_SHIFT)
 #  define pfn_valid(pfn)	((pfn) < (max_mapnr + ARCH_PFN_OFFSET))
-#  define VALID_PAGE(page) 	((page - mem_map) < max_mapnr)
 #  endif /* CONFIG_MMU */
 
 # endif /* __ASSEMBLY__ */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 15/19] mm/ARM: fix stale comment about VALID_PAGE()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (13 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 14/19] mm/microblaze: " Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 16/19] mm/unicore32: " Jiang Liu
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel, Russell King,
	Will Deacon, Nicolas Pitre, Stephen Boyd, Giancarlo Asnaghi,
	linux-arm-kernel

VALID_PAGE() has been removed from kernel long time ago,
so fix the comment.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Nicolas Pitre <nico@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Giancarlo Asnaghi <giancarlo.asnaghi@st.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/include/asm/memory.h |    6 ------
 1 file changed, 6 deletions(-)

diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 57870ab..0cd2a3d 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -260,12 +260,6 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
 /*
  * Conversion between a struct page and a physical address.
  *
- * Note: when converting an unknown physical address to a
- * struct page, the resulting pointer must be validated
- * using VALID_PAGE().  It must return an invalid struct page
- * for any physical address not corresponding to a system
- * RAM address.
- *
  *  page_to_pfn(page)	convert a struct page * to a PFN number
  *  pfn_to_page(pfn)	convert a _valid_ PFN number to struct page *
  *
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 16/19] mm/unicore32: fix stale comment about VALID_PAGE()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (14 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 15/19] mm/ARM: fix stale comment about VALID_PAGE() Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-15 19:11   ` Xuetao Guan
  2013-04-13 15:36 ` [RFC PATCH v1 17/19] mm/m68k: fix build warning of unused variable Jiang Liu
                   ` (3 subsequent siblings)
  19 siblings, 1 reply; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel, Guan Xuetao

VALID_PAGE() has been removed from kernel long time ago,
so fix the comment.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: linux-kernel@vger.kernel.org
---
 arch/unicore32/include/asm/memory.h |    6 ------
 1 file changed, 6 deletions(-)

diff --git a/arch/unicore32/include/asm/memory.h b/arch/unicore32/include/asm/memory.h
index 5eddb99..debafc4 100644
--- a/arch/unicore32/include/asm/memory.h
+++ b/arch/unicore32/include/asm/memory.h
@@ -98,12 +98,6 @@
 /*
  * Conversion between a struct page and a physical address.
  *
- * Note: when converting an unknown physical address to a
- * struct page, the resulting pointer must be validated
- * using VALID_PAGE().  It must return an invalid struct page
- * for any physical address not corresponding to a system
- * RAM address.
- *
  *  page_to_pfn(page)	convert a struct page * to a PFN number
  *  pfn_to_page(pfn)	convert a _valid_ PFN number to struct page *
  *
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 17/19] mm/m68k: fix build warning of unused variable
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (15 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 16/19] mm/unicore32: " Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 18/19] mm/alpha: unify mem_init() for both UMA and NUMA architectures Jiang Liu
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel,
	Geert Uytterhoeven, Greg Ungerer, Thadeu Lima de Souza Cascardo,
	linux-m68k

Fix build warning of unused variable:
arch/m68k/mm/init.c: In function 'mem_init':
arch/m68k/mm/init.c:151:6: warning: unused variable 'i' [-Wunused-variable]

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg Ungerer <gerg@uclinux.org>
Cc: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-kernel@vger.kernel.org
---
 arch/m68k/mm/init.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 20d0ae2..e4cb0af 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -146,14 +146,11 @@ void __init print_memmap(void)
 		MLK_ROUNDUP(__bss_start, __bss_stop));
 }
 
-void __init mem_init(void)
+static inline void init_pointer_tables(void)
 {
+#if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
 	int i;
 
-	/* this will put all memory onto the freelists */
-	free_all_bootmem();
-
-#if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
 	/* insert pointer tables allocated so far into the tablelist */
 	init_pointer_table((unsigned long)kernel_pg_dir);
 	for (i = 0; i < PTRS_PER_PGD; i++) {
@@ -165,7 +162,13 @@ void __init mem_init(void)
 	if (zero_pgtable)
 		init_pointer_table((unsigned long)zero_pgtable);
 #endif
+}
 
+void __init mem_init(void)
+{
+	/* this will put all memory onto the freelists */
+	free_all_bootmem();
+	init_pointer_tables();
 	mem_init_print_info(NULL);
 	print_memmap();
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 18/19] mm/alpha: unify mem_init() for both UMA and NUMA architectures
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (16 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 17/19] mm/m68k: fix build warning of unused variable Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-13 15:36 ` [RFC PATCH v1 19/19] mm: call register_page_bootmem_info_node() from mm core Jiang Liu
  2013-04-15  4:56 ` [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Paul Mackerras
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel,
	Richard Henderson, Ivan Kokshaysky, Matt Turner, linux-alpha

Now mem_init() for both Alpha UMA and Alpha NUMA are the same,
so unify it to reduce duplicated code.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: linux-alpha@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 arch/alpha/mm/init.c |    7 ++-----
 arch/alpha/mm/numa.c |   10 ----------
 2 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index 04c933c..39de408 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -276,17 +276,14 @@ srm_paging_stop (void)
 }
 #endif
 
-#ifndef CONFIG_DISCONTIGMEM
 void __init
 mem_init(void)
 {
-	max_mapnr = max_low_pfn;
-	free_all_bootmem();
+	set_max_mapnr(max_low_pfn);
 	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
-
+	free_all_bootmem();
 	mem_init_print_info(NULL);
 }
-#endif /* CONFIG_DISCONTIGMEM */
 
 void
 free_initmem(void)
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
index 0894b3a8..d543d71 100644
--- a/arch/alpha/mm/numa.c
+++ b/arch/alpha/mm/numa.c
@@ -319,13 +319,3 @@ void __init paging_init(void)
 	/* Initialize the kernel's ZERO_PGE. */
 	memset((void *)ZERO_PGE, 0, PAGE_SIZE);
 }
-
-void __init mem_init(void)
-{
-	high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
-	free_all_bootmem();
-	mem_init_print_info(NULL);
-#if 0
-	mem_stress();
-#endif
-}
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [RFC PATCH v1 19/19] mm: call register_page_bootmem_info_node() from mm core
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (17 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 18/19] mm/alpha: unify mem_init() for both UMA and NUMA architectures Jiang Liu
@ 2013-04-13 15:36 ` Jiang Liu
  2013-04-15  4:56 ` [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Paul Mackerras
  19 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-13 15:36 UTC (permalink / raw)
  To: Andrew Morton, Yinghai Lu
  Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
	KAMEZAWA Hiroyuki, Michal Hocko, David Howells, Mark Salter,
	Jianguo Wu, linux-mm, linux-arch, linux-kernel, David S. Miller,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	Yasuaki Ishimatsu, Johannes Weiner, Tejun Heo, sparclinux

Function register_page_bootmem_info_node() is suitably defined for
both HOTPLUG and non-HOTPLUG configurations, so we could call it
from mm core instead of arch specific code. This could simplify
arch implementations.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: sparclinux@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
---
 arch/sparc/mm/init_64.c |   12 ------------
 arch/x86/mm/init_64.c   |   12 ------------
 mm/bootmem.c            |    6 ++++++
 mm/nobootmem.c          |    6 ++++++
 4 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index b1e35b7..5530c09 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -2027,16 +2027,6 @@ static void __init patch_tlb_miss_handler_bitmap(void)
 	flushi(&valid_addr_bitmap_insn[0]);
 }
 
-static void __init register_page_bootmem_info(void)
-{
-#ifdef CONFIG_NEED_MULTIPLE_NODES
-	int i;
-
-	for_each_online_node(i)
-		if (NODE_DATA(i)->node_spanned_pages)
-			register_page_bootmem_info_node(NODE_DATA(i));
-#endif
-}
 void __init mem_init(void)
 {
 	unsigned long addr, last;
@@ -2052,8 +2042,6 @@ void __init mem_init(void)
 	patch_tlb_miss_handler_bitmap();
 
 	high_memory = __va(last_valid_pfn << PAGE_SHIFT);
-
-	register_page_bootmem_info();
 	free_all_bootmem();
 
 	/*
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 650264b..72b5141 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1031,24 +1031,12 @@ int __ref arch_remove_memory(u64 start, u64 size)
 
 static struct kcore_list kcore_vsyscall;
 
-static void __init register_page_bootmem_info(void)
-{
-#ifdef CONFIG_NUMA
-	int i;
-
-	for_each_online_node(i)
-		register_page_bootmem_info_node(NODE_DATA(i));
-#endif
-}
-
 void __init mem_init(void)
 {
 	pci_iommu_alloc();
 
 	/* clear_bss() already clear the empty_zero_page */
 
-	register_page_bootmem_info();
-
 	/* this will put all memory onto the freelists */
 	free_all_bootmem();
 	after_bootmem = 1;
diff --git a/mm/bootmem.c b/mm/bootmem.c
index fab8f63..3cf36ac 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -273,6 +273,12 @@ unsigned long __init free_all_bootmem(void)
 {
 	unsigned long total_pages = 0;
 	bootmem_data_t *bdata;
+#ifdef CONFIG_NEED_MULTIPLE_NODES
+	pg_data_t *pgdat;
+
+	for_each_online_pgdat(pgdat)
+		register_page_bootmem_info_node(pgdat);
+#endif
 
 	reset_all_zones_managed_pages();
 
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index 6b63cd6..ccc6630 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -166,6 +166,12 @@ void __init reset_all_zones_managed_pages(void)
 unsigned long __init free_all_bootmem(void)
 {
 	unsigned long pages;
+#ifdef CONFIG_NEED_MULTIPLE_NODES
+	pg_data_t *pgdat;
+
+	for_each_online_pgdat(pgdat)
+		register_page_bootmem_info_node(pgdat);
+#endif
 
 	reset_all_zones_managed_pages();
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE()
  2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
                   ` (18 preceding siblings ...)
  2013-04-13 15:36 ` [RFC PATCH v1 19/19] mm: call register_page_bootmem_info_node() from mm core Jiang Liu
@ 2013-04-15  4:56 ` Paul Mackerras
  2013-04-16 15:04   ` Jiang Liu
  19 siblings, 1 reply; 24+ messages in thread
From: Paul Mackerras @ 2013-04-15  4:56 UTC (permalink / raw)
  To: Jiang Liu
  Cc: Andrew Morton, Yinghai Lu, Jiang Liu, David Rientjes,
	Wen Congyang, Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki,
	Michal Hocko, David Howells, Mark Salter, Jianguo Wu, linux-mm,
	linux-arch, linux-kernel

On Sat, Apr 13, 2013 at 11:36:20PM +0800, Jiang Liu wrote:
> Commit 600cc5b7f6 "mm: Kill NO_BOOTMEM version free_all_bootmem_node()"
> has kill free_all_bootmem_node() for NO_BOOTMEM.
> 
> Currently the usage pattern for free_all_bootmem_node() is like:
> for_each_online_pgdat(pgdat)
> 	free_all_bootmem_node(pgdat);
> 
> It's equivalent to free_all_bootmem(), so this patchset goes one
> step further to kill free_all_bootmem_node() for BOOTMEM too.
> 
> This patchset also tries to clean up code and comments related to
> VALID_PAGE() because it has been removed from kernel long time ago.
> 
> Patch 1-11:
> 	Kill free_all_bootmem_node()
> Patch 12-16:
> 	Clean up code and comments related to VALID_PAGE()
> Patch 17:
> 	Fix a minor build warning for m68k
> Patch 18:
> 	merge Alpha's mem_init() for UMA and NUMA.
> Patch 19:
> 	call register_page_bootmem_info_node() from mm core

How does this not break bisection?  Will a kernel still boot with
patches 1-11 applied but not patch 19?  As far as I can see such a
kernel would have no memory available to it after mem_init() time
and would therefore crash early in boot.

Paul.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v1 13/19] mm/CRIS: clean up unused VALID_PAGE()
  2013-04-13 15:36 ` [RFC PATCH v1 13/19] mm/CRIS: " Jiang Liu
@ 2013-04-15 13:14   ` Jesper Nilsson
  0 siblings, 0 replies; 24+ messages in thread
From: Jesper Nilsson @ 2013-04-15 13:14 UTC (permalink / raw)
  To: Jiang Liu
  Cc: Andrew Morton, Yinghai Lu, Jiang Liu, David Rientjes,
	Wen Congyang, Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki,
	Michal Hocko, David Howells, Mark Salter, Jianguo Wu, linux-mm,
	linux-arch, linux-kernel, Mikael Starvik, Jesper Nilsson,
	linux-cris-kernel

On Sat, Apr 13, 2013 at 05:36:33PM +0200, Jiang Liu wrote:
> VALID_PAGE() has been removed from kernel long time ago, so clean up it.
> 
> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
> Cc: Mikael Starvik <starvik@axis.com>
> Cc: Jiang Liu <jiang.liu@huawei.com>
> Cc: linux-cris-kernel@axis.com
> Cc: linux-kernel@vger.kernel.org

Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>

/^JN - Jesper Nilsson
-- 
               Jesper Nilsson -- jesper.nilsson@axis.com

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v1 16/19] mm/unicore32: fix stale comment about  VALID_PAGE()
  2013-04-13 15:36 ` [RFC PATCH v1 16/19] mm/unicore32: " Jiang Liu
@ 2013-04-15 19:11   ` Xuetao Guan
  0 siblings, 0 replies; 24+ messages in thread
From: Xuetao Guan @ 2013-04-15 19:11 UTC (permalink / raw)
  To: Jiang Liu
  Cc: Andrew Morton, Yinghai Lu, Jiang Liu, David Rientjes,
	Wen Congyang, Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki,
	Michal Hocko, David Howells, Mark Salter, Jianguo Wu, linux-mm,
	linux-arch, linux-kernel, Guan Xuetao

> VALID_PAGE() has been removed from kernel long time ago,
> so fix the comment.
>
> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
> Cc: linux-kernel@vger.kernel.org

Thanks,

Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>

> ---
>  arch/unicore32/include/asm/memory.h |    6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/arch/unicore32/include/asm/memory.h
> b/arch/unicore32/include/asm/memory.h
> index 5eddb99..debafc4 100644
> --- a/arch/unicore32/include/asm/memory.h
> +++ b/arch/unicore32/include/asm/memory.h
> @@ -98,12 +98,6 @@
>  /*
>   * Conversion between a struct page and a physical address.
>   *
> - * Note: when converting an unknown physical address to a
> - * struct page, the resulting pointer must be validated
> - * using VALID_PAGE().  It must return an invalid struct page
> - * for any physical address not corresponding to a system
> - * RAM address.
> - *
>   *  page_to_pfn(page)	convert a struct page * to a PFN number
>   *  pfn_to_page(pfn)	convert a _valid_ PFN number to struct page *
>   *
> --
> 1.7.9.5
>


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE()
  2013-04-15  4:56 ` [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Paul Mackerras
@ 2013-04-16 15:04   ` Jiang Liu
  0 siblings, 0 replies; 24+ messages in thread
From: Jiang Liu @ 2013-04-16 15:04 UTC (permalink / raw)
  To: Paul Mackerras
  Cc: Andrew Morton, Yinghai Lu, Jiang Liu, David Rientjes,
	Wen Congyang, Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki,
	Michal Hocko, David Howells, Mark Salter, Jianguo Wu, linux-mm,
	linux-arch, linux-kernel

On 04/15/2013 12:56 PM, Paul Mackerras wrote:
> On Sat, Apr 13, 2013 at 11:36:20PM +0800, Jiang Liu wrote:
>> Commit 600cc5b7f6 "mm: Kill NO_BOOTMEM version free_all_bootmem_node()"
>> has kill free_all_bootmem_node() for NO_BOOTMEM.
>>
>> Currently the usage pattern for free_all_bootmem_node() is like:
>> for_each_online_pgdat(pgdat)
>> 	free_all_bootmem_node(pgdat);
>>
>> It's equivalent to free_all_bootmem(), so this patchset goes one
>> step further to kill free_all_bootmem_node() for BOOTMEM too.
>>
>> This patchset also tries to clean up code and comments related to
>> VALID_PAGE() because it has been removed from kernel long time ago.
>>
>> Patch 1-11:
>> 	Kill free_all_bootmem_node()
>> Patch 12-16:
>> 	Clean up code and comments related to VALID_PAGE()
>> Patch 17:
>> 	Fix a minor build warning for m68k
>> Patch 18:
>> 	merge Alpha's mem_init() for UMA and NUMA.
>> Patch 19:
>> 	call register_page_bootmem_info_node() from mm core
> 
> How does this not break bisection?  Will a kernel still boot with
> patches 1-11 applied but not patch 19?  As far as I can see such a
> kernel would have no memory available to it after mem_init() time
> and would therefore crash early in boot.
Hi Paul,
	Thanks for review!
	Patch 1-11 replace free_all_bootmem_node() with free_all_bootmem(),
so all normal pages will be freed into the buddy system as before. And
patch 1-11 are independent with patch 19.
	Gerry
> 
> Paul.
> 


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2013-04-16 15:04 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-13 15:36 [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 01/19] mm: introduce accessor function set_max_mapnr() Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 02/19] mm/AVR32: prepare for killing free_all_bootmem_node() Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 03/19] mm/IA64: " Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 04/19] mm/m32r: " Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 05/19] mm/m68k: " Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 06/19] mm/metag: " Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 07/19] mm/MIPS: " Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 08/19] mm/PARISC: " Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 09/19] mm/PPC: " Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 10/19] mm/SH: " Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 11/19] mm: kill free_all_bootmem_node() Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 12/19] mm/ALPHA: clean up unused VALID_PAGE() Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 13/19] mm/CRIS: " Jiang Liu
2013-04-15 13:14   ` Jesper Nilsson
2013-04-13 15:36 ` [RFC PATCH v1 14/19] mm/microblaze: " Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 15/19] mm/ARM: fix stale comment about VALID_PAGE() Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 16/19] mm/unicore32: " Jiang Liu
2013-04-15 19:11   ` Xuetao Guan
2013-04-13 15:36 ` [RFC PATCH v1 17/19] mm/m68k: fix build warning of unused variable Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 18/19] mm/alpha: unify mem_init() for both UMA and NUMA architectures Jiang Liu
2013-04-13 15:36 ` [RFC PATCH v1 19/19] mm: call register_page_bootmem_info_node() from mm core Jiang Liu
2013-04-15  4:56 ` [RFC PATCH v1 00/19] kill free_all_bootmem() and clean up VALID_PAGE() Paul Mackerras
2013-04-16 15:04   ` Jiang Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).