* [PATCH v2, part2 01/10] mm: introduce free_highmem_page() helper to free highmem pages into buddy system
2013-03-10 8:01 [PATCH v2, part2 00/10] simplify initialization of highmem pages Jiang Liu
@ 2013-03-10 8:01 ` Jiang Liu
2013-03-10 10:44 ` Pekka Enberg
2013-03-10 8:01 ` [PATCH v2, part2 02/10] mm/ARM: use free_highmem_page() " Jiang Liu
` (8 subsequent siblings)
9 siblings, 1 reply; 17+ messages in thread
From: Jiang Liu @ 2013-03-10 8:01 UTC (permalink / raw)
To: Andrew Morton, David Rientjes
Cc: Jiang Liu, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, Jianguo Wu, linux-mm,
linux-kernel, Michel Lespinasse, Rik van Riel,
Konstantin Khlebnikov, Marek Szyprowski, Michal Nazarewicz,
Russell King, David Howells, James Hogan, Michal Simek,
Ralf Baechle, David Daney, David S. Miller, Sam Ravnborg,
Jeff Dike, Richard Weinberger, H. Peter Anvin
Introduce helper function free_highmem_page(), which will be used by
architectures with HIGHMEM enabled to free highmem pages into the buddy
system.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michel Lespinasse <walken@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Cc: Russell King <linux@arm.linux.org.uk>
Cc: David Howells <dhowells@redhat.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Daney <david.daney@cavium.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
include/linux/mm.h | 7 +++++++
mm/page_alloc.c | 9 +++++++++
2 files changed, 16 insertions(+)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d75c14b..f2fb750 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -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)
{
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0fadb09..37bc8ab 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -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
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v2, part2 01/10] mm: introduce free_highmem_page() helper to free highmem pages into buddy system
2013-03-10 8:01 ` [PATCH v2, part2 01/10] mm: introduce free_highmem_page() helper to free highmem pages into buddy system Jiang Liu
@ 2013-03-10 10:44 ` Pekka Enberg
0 siblings, 0 replies; 17+ messages in thread
From: Pekka Enberg @ 2013-03-10 10:44 UTC (permalink / raw)
To: Jiang Liu
Cc: Andrew Morton, David Rientjes, Jiang Liu, Wen Congyang,
Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko,
Jianguo Wu, linux-mm, linux-kernel, Michel Lespinasse,
Rik van Riel, Konstantin Khlebnikov, Marek Szyprowski,
Michal Nazarewicz, Russell King, David Howells, James Hogan,
Michal Simek, Ralf Baechle, David Daney, David S. Miller,
Sam Ravnborg, Jeff Dike, Richard Weinberger, H. Peter Anvin
On Sun, Mar 10, 2013 at 10:01 AM, Jiang Liu <liuj97@gmail.com> wrote:
> Introduce helper function free_highmem_page(), which will be used by
> architectures with HIGHMEM enabled to free highmem pages into the buddy
> system.
>
> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2, part2 02/10] mm/ARM: use free_highmem_page() to free highmem pages into buddy system
2013-03-10 8:01 [PATCH v2, part2 00/10] simplify initialization of highmem pages Jiang Liu
2013-03-10 8:01 ` [PATCH v2, part2 01/10] mm: introduce free_highmem_page() helper to free highmem pages into buddy system Jiang Liu
@ 2013-03-10 8:01 ` Jiang Liu
2013-03-10 8:01 ` [PATCH v2, part2 03/10] mm/FRV: " Jiang Liu
` (7 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Jiang Liu @ 2013-03-10 8:01 UTC (permalink / raw)
To: Andrew Morton, David Rientjes
Cc: Jiang Liu, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, Jianguo Wu, linux-mm,
linux-kernel, Russell King, Linus Walleij, Marek Szyprowski,
Stephen Boyd, linux-arm-kernel
Use helper function free_highmem_page() to free highmem pages into
the buddy system.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Linus Walleij <linus.walleij@linaro.org>
cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
arch/arm/mm/init.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 40a5bc2..687a114 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -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
}
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2, part2 03/10] mm/FRV: use free_highmem_page() to free highmem pages into buddy system
2013-03-10 8:01 [PATCH v2, part2 00/10] simplify initialization of highmem pages Jiang Liu
2013-03-10 8:01 ` [PATCH v2, part2 01/10] mm: introduce free_highmem_page() helper to free highmem pages into buddy system Jiang Liu
2013-03-10 8:01 ` [PATCH v2, part2 02/10] mm/ARM: use free_highmem_page() " Jiang Liu
@ 2013-03-10 8:01 ` Jiang Liu
2013-03-10 8:01 ` [PATCH v2, part2 04/10] mm/metag: " Jiang Liu
` (6 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Jiang Liu @ 2013-03-10 8:01 UTC (permalink / raw)
To: Andrew Morton, David Rientjes
Cc: Jiang Liu, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, Jianguo Wu, linux-mm,
linux-kernel, David Howells, Geert Uytterhoeven
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.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-kernel@vger.kernel.org
---
arch/frv/mm/init.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index 21b9290..dee354f 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -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;
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2, part2 04/10] mm/metag: use free_highmem_page() to free highmem pages into buddy system
2013-03-10 8:01 [PATCH v2, part2 00/10] simplify initialization of highmem pages Jiang Liu
` (2 preceding siblings ...)
2013-03-10 8:01 ` [PATCH v2, part2 03/10] mm/FRV: " Jiang Liu
@ 2013-03-10 8:01 ` Jiang Liu
2013-03-10 8:01 ` [PATCH v2, part2 05/10] mm/microblaze: " Jiang Liu
` (5 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Jiang Liu @ 2013-03-10 8:01 UTC (permalink / raw)
To: Andrew Morton, David Rientjes
Cc: Jiang Liu, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, Jianguo Wu, linux-mm,
linux-kernel, James Hogan
Use helper function free_highmem_page() to free highmem pages into
the buddy system.
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 | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c
index c6784fb..d05b845 100644
--- a/arch/metag/mm/init.c
+++ b/arch/metag/mm/init.c
@@ -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 */
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2, part2 05/10] mm/microblaze: use free_highmem_page() to free highmem pages into buddy system
2013-03-10 8:01 [PATCH v2, part2 00/10] simplify initialization of highmem pages Jiang Liu
` (3 preceding siblings ...)
2013-03-10 8:01 ` [PATCH v2, part2 04/10] mm/metag: " Jiang Liu
@ 2013-03-10 8:01 ` Jiang Liu
2013-03-10 8:01 ` [PATCH v2, part2 06/10] mm/MIPS: " Jiang Liu
` (4 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Jiang Liu @ 2013-03-10 8:01 UTC (permalink / raw)
To: Andrew Morton, David Rientjes
Cc: Jiang Liu, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, Jianguo Wu, linux-mm,
linux-kernel, Michal Simek, microblaze-uclinux
Use helper function free_highmem_page() to free highmem pages into
the buddy system.
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/mm/init.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index 9be5302..4ec137d 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -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));
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2, part2 06/10] mm/MIPS: use free_highmem_page() to free highmem pages into buddy system
2013-03-10 8:01 [PATCH v2, part2 00/10] simplify initialization of highmem pages Jiang Liu
` (4 preceding siblings ...)
2013-03-10 8:01 ` [PATCH v2, part2 05/10] mm/microblaze: " Jiang Liu
@ 2013-03-10 8:01 ` Jiang Liu
2013-03-10 8:01 ` [PATCH v2, part2 07/10] mm/PPC: " Jiang Liu
` (3 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Jiang Liu @ 2013-03-10 8:01 UTC (permalink / raw)
To: Andrew Morton, David Rientjes
Cc: Jiang Liu, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, Jianguo Wu, linux-mm,
linux-kernel, Ralf Baechle, David Daney, Cong Wang, Arnd Bergmann,
linux-mips
Use helper function free_highmem_page() to free highmem pages into
the buddy system.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Daney <david.daney@cavium.com>
Cc: Cong Wang <amwang@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
---
arch/mips/mm/init.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 60f7c61..3d0346d 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -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
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2, part2 07/10] mm/PPC: use free_highmem_page() to free highmem pages into buddy system
2013-03-10 8:01 [PATCH v2, part2 00/10] simplify initialization of highmem pages Jiang Liu
` (5 preceding siblings ...)
2013-03-10 8:01 ` [PATCH v2, part2 06/10] mm/MIPS: " Jiang Liu
@ 2013-03-10 8:01 ` Jiang Liu
2013-03-10 8:01 ` [PATCH v2, part2 08/10] mm/SPARC: " Jiang Liu
` (2 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Jiang Liu @ 2013-03-10 8:01 UTC (permalink / raw)
To: Andrew Morton, David Rientjes
Cc: Jiang Liu, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, Jianguo Wu, linux-mm,
linux-kernel, Benjamin Herrenschmidt, Paul Mackerras,
Alexander Graf, Suzuki K. Poulose, linuxppc-dev
Use helper function free_highmem_page() to free highmem pages into
the buddy system.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.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 | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index c756713..68f51d0 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -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));
}
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2, part2 08/10] mm/SPARC: use free_highmem_page() to free highmem pages into buddy system
2013-03-10 8:01 [PATCH v2, part2 00/10] simplify initialization of highmem pages Jiang Liu
` (6 preceding siblings ...)
2013-03-10 8:01 ` [PATCH v2, part2 07/10] mm/PPC: " Jiang Liu
@ 2013-03-10 8:01 ` Jiang Liu
2013-03-12 21:42 ` Andrew Morton
2013-03-10 8:01 ` [PATCH v2, part2 09/10] mm/um: " Jiang Liu
2013-03-10 8:01 ` [PATCH v2, part2 10/10] mm/x86: " Jiang Liu
9 siblings, 1 reply; 17+ messages in thread
From: Jiang Liu @ 2013-03-10 8:01 UTC (permalink / raw)
To: Andrew Morton, David Rientjes
Cc: Jiang Liu, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, Jianguo Wu, linux-mm,
linux-kernel, David S. Miller, Sam Ravnborg, sparclinux
Use helper function free_highmem_page() to free highmem pages into
the buddy system.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: sparclinux@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
arch/sparc/mm/init_32.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index 13d6fee..6a7eb68 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -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));
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v2, part2 08/10] mm/SPARC: use free_highmem_page() to free highmem pages into buddy system
2013-03-10 8:01 ` [PATCH v2, part2 08/10] mm/SPARC: " Jiang Liu
@ 2013-03-12 21:42 ` Andrew Morton
2013-03-13 6:34 ` Sam Ravnborg
2013-03-13 16:47 ` Jiang Liu
0 siblings, 2 replies; 17+ messages in thread
From: Andrew Morton @ 2013-03-12 21:42 UTC (permalink / raw)
To: Jiang Liu
Cc: David Rientjes, Jiang Liu, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, Jianguo Wu, linux-mm,
linux-kernel, David S. Miller, Sam Ravnborg, sparclinux
On Sun, 10 Mar 2013 16:01:08 +0800 Jiang Liu <liuj97@gmail.com> wrote:
> Use helper function free_highmem_page() to free highmem pages into
> the buddy system.
>
> ...
>
> --- a/arch/sparc/mm/init_32.c
> +++ b/arch/sparc/mm/init_32.c
> @@ -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));
> }
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.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2, part2 08/10] mm/SPARC: use free_highmem_page() to free highmem pages into buddy system
2013-03-12 21:42 ` Andrew Morton
@ 2013-03-13 6:34 ` Sam Ravnborg
2013-03-13 16:47 ` Jiang Liu
1 sibling, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2013-03-13 6:34 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Jiang Liu, Wen Congyang, Mel Gorman,
Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko, Jianguo Wu,
linux-mm, linux-kernel, David S. Miller, sparclinux
On Tue, Mar 12, 2013 at 02:42:15PM -0700, Andrew Morton wrote:
> On Sun, 10 Mar 2013 16:01:08 +0800 Jiang Liu <liuj97@gmail.com> wrote:
>
> > Use helper function free_highmem_page() to free highmem pages into
> > the buddy system.
> >
> > ...
> >
> > --- a/arch/sparc/mm/init_32.c
> > +++ b/arch/sparc/mm/init_32.c
> > @@ -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));
> > }
>
> 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
> This patch and one other mistyped "free_highmem_page". I got lazy and
> edited those patches in-place.
Good spot!
You can add my:
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Sam
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2, part2 08/10] mm/SPARC: use free_highmem_page() to free highmem pages into buddy system
2013-03-12 21:42 ` Andrew Morton
2013-03-13 6:34 ` Sam Ravnborg
@ 2013-03-13 16:47 ` Jiang Liu
1 sibling, 0 replies; 17+ messages in thread
From: Jiang Liu @ 2013-03-13 16:47 UTC (permalink / raw)
To: Andrew Morton
Cc: David Rientjes, Jiang Liu, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, Jianguo Wu, linux-mm,
linux-kernel, David S. Miller, Sam Ravnborg, sparclinux
On 03/13/2013 05:42 AM, Andrew Morton wrote:
> On Sun, 10 Mar 2013 16:01:08 +0800 Jiang Liu <liuj97@gmail.com> wrote:
>
>> Use helper function free_highmem_page() to free highmem pages into
>> the buddy system.
>>
>> ...
>>
>> --- a/arch/sparc/mm/init_32.c
>> +++ b/arch/sparc/mm/init_32.c
>> @@ -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));
>> }
>
> 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.
>
Hi Andrew,
Great thanks for fixing them!
Gerry
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2, part2 09/10] mm/um: use free_highmem_page() to free highmem pages into buddy system
2013-03-10 8:01 [PATCH v2, part2 00/10] simplify initialization of highmem pages Jiang Liu
` (7 preceding siblings ...)
2013-03-10 8:01 ` [PATCH v2, part2 08/10] mm/SPARC: " Jiang Liu
@ 2013-03-10 8:01 ` Jiang Liu
2013-03-10 8:01 ` [PATCH v2, part2 10/10] mm/x86: " Jiang Liu
9 siblings, 0 replies; 17+ messages in thread
From: Jiang Liu @ 2013-03-10 8:01 UTC (permalink / raw)
To: Andrew Morton, David Rientjes
Cc: Jiang Liu, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, Jianguo Wu, linux-mm,
linux-kernel, Jeff Dike, Richard Weinberger,
user-mode-linux-devel
Use helper function free_highmem_page() to free highmem pages into
the buddy system.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
---
arch/um/kernel/mem.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index d5ac802..9df292b 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -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
}
/*
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2, part2 10/10] mm/x86: use free_highmem_page() to free highmem pages into buddy system
2013-03-10 8:01 [PATCH v2, part2 00/10] simplify initialization of highmem pages Jiang Liu
` (8 preceding siblings ...)
2013-03-10 8:01 ` [PATCH v2, part2 09/10] mm/um: " Jiang Liu
@ 2013-03-10 8:01 ` Jiang Liu
2013-03-10 10:32 ` Pekka Enberg
9 siblings, 1 reply; 17+ messages in thread
From: Jiang Liu @ 2013-03-10 8:01 UTC (permalink / raw)
To: Andrew Morton, David Rientjes
Cc: Jiang Liu, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, Jianguo Wu, linux-mm,
linux-kernel, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Cong Wang, Yinghai Lu, Attilio Rao, konrad.wilk
Use helper function free_highmem_page() to free highmem pages into
the buddy system.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Cong Wang <amwang@redhat.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Attilio Rao <attilio.rao@citrix.com>
Cc: konrad.wilk@oracle.com
Cc: linux-kernel@vger.kernel.org
---
arch/x86/mm/highmem_32.c | 1 -
arch/x86/mm/init_32.c | 10 +---------
2 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
index 6f31ee5..252b8f5 100644
--- a/arch/x86/mm/highmem_32.c
+++ b/arch/x86/mm/highmem_32.c
@@ -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;
}
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 2d19001..3ac7e31 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -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
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v2, part2 10/10] mm/x86: use free_highmem_page() to free highmem pages into buddy system
2013-03-10 8:01 ` [PATCH v2, part2 10/10] mm/x86: " Jiang Liu
@ 2013-03-10 10:32 ` Pekka Enberg
2013-03-10 10:40 ` Pekka Enberg
0 siblings, 1 reply; 17+ messages in thread
From: Pekka Enberg @ 2013-03-10 10:32 UTC (permalink / raw)
To: Jiang Liu
Cc: Andrew Morton, David Rientjes, Jiang Liu, Wen Congyang,
Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko,
Jianguo Wu, linux-mm, linux-kernel, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, Cong Wang, Yinghai Lu, Attilio Rao,
konrad.wilk
On Sun, Mar 10, 2013 at 10:01 AM, Jiang Liu <liuj97@gmail.com> wrote:
> Use helper function free_highmem_page() to free highmem pages into
> the buddy system.
>
> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
> ---
> arch/x86/mm/highmem_32.c | 1 -
> arch/x86/mm/init_32.c | 10 +---------
> 2 files changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
> index 6f31ee5..252b8f5 100644
> --- a/arch/x86/mm/highmem_32.c
> +++ b/arch/x86/mm/highmem_32.c
> @@ -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?
> }
> diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
> index 2d19001..3ac7e31 100644
> --- a/arch/x86/mm/init_32.c
> +++ b/arch/x86/mm/init_32.c
> @@ -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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> 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 majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2, part2 10/10] mm/x86: use free_highmem_page() to free highmem pages into buddy system
2013-03-10 10:32 ` Pekka Enberg
@ 2013-03-10 10:40 ` Pekka Enberg
0 siblings, 0 replies; 17+ messages in thread
From: Pekka Enberg @ 2013-03-10 10:40 UTC (permalink / raw)
To: Jiang Liu
Cc: Andrew Morton, David Rientjes, Jiang Liu, Wen Congyang,
Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko,
Jianguo Wu, linux-mm, linux-kernel, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86, Cong Wang, Yinghai Lu, Attilio Rao,
konrad.wilk
On Sun, Mar 10, 2013 at 12:32 PM, Pekka Enberg <penberg@kernel.org> wrote:
> On Sun, Mar 10, 2013 at 10:01 AM, Jiang Liu <liuj97@gmail.com> wrote:
>> Use helper function free_highmem_page() to free highmem pages into
>> the buddy system.
>>
>> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
>> ---
>> arch/x86/mm/highmem_32.c | 1 -
>> arch/x86/mm/init_32.c | 10 +---------
>> 2 files changed, 1 insertion(+), 10 deletions(-)
>>
>> diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
>> index 6f31ee5..252b8f5 100644
>> --- a/arch/x86/mm/highmem_32.c
>> +++ b/arch/x86/mm/highmem_32.c
>> @@ -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:
Reviewed-by: Pekka Enberg <penberg@kernel.org>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 17+ messages in thread