Re: [Patch] Allocate sparsemem memmap above 4G on X86_64

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Zou Nan hai
Date: Thursday, May 17, 2007 - 7:52 pm

On Fri, 2007-05-18 at 03:32, Andrew Morton wrote:
  On systems with huge amount of physical memory, VFS cache and memory
memmap may eat all available system memory under 4G, then the system may
fail to allocate swiotlb bounce buffer.
  There was a fix for this issue in arch/x86_64/mm/numa.c, but that fix
dose not cover sparsemem model.
  This patch add fix to sparsemem model by first try to allocate memmap
above 4G.

Signed-off-by:	Zou Nan hai <nanhai.zou@intel.com>
Acked-by:	Suresh Siddha <suresh.b.siddha@intel.com>
---
 arch/x86_64/mm/init.c |    6 ++++++
 mm/sparse.c           |   11 +++++++++++
 2 files changed, 17 insertions(+)

diff -Nraup a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
--- a/arch/x86_64/mm/init.c	2007-05-19 16:54:46.000000000 +0800
+++ b/arch/x86_64/mm/init.c	2007-05-19 17:43:47.000000000 +0800
@@ -761,3 +761,9 @@ int in_gate_area_no_task(unsigned long a
 {
 	return (addr >= VSYSCALL_START) && (addr < VSYSCALL_END);
 }
+
+void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
+{
+	return __alloc_bootmem_core(pgdat->bdata, size,
+			SMP_CACHE_BYTES, (4UL*1024*1024*1024), 0);
+}
diff -Nraup a/mm/sparse.c b/mm/sparse.c
--- a/mm/sparse.c	2007-05-19 16:54:48.000000000 +0800
+++ b/mm/sparse.c	2007-05-19 17:44:01.000000000 +0800
@@ -209,6 +209,12 @@ static int __meminit sparse_init_one_sec
 	return 1;
 }
 
+__attribute__((weak))
+void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size)
+{
+	return NULL;
+}
+
 static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum)
 {
 	struct page *map;
@@ -219,6 +225,11 @@ static struct page __init *sparse_early_
 	if (map)
 		return map;
 
+  	map = alloc_bootmem_high_node(NODE_DATA(nid),
+                       sizeof(struct page) * PAGES_PER_SECTION);
+	if (map)
+		return map;
+
 	map = alloc_bootmem_node(NODE_DATA(nid),
 			sizeof(struct page) * PAGES_PER_SECTION);
 	if (map)
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[Patch] Allocate sparsemem memmap above 4G on X86_64, Zou Nan hai, (Wed May 16, 7:40 pm)
Re: [Patch] Allocate sparsemem memmap above 4G on X86_64, Andrew Morton, (Thu May 17, 12:32 pm)
Re: [Patch] Allocate sparsemem memmap above 4G on X86_64, Zou Nan hai, (Thu May 17, 7:52 pm)
Re: [Patch] Allocate sparsemem memmap above 4G on X86_64, Andrew Morton, (Thu May 17, 8:22 pm)