public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]X86: make sparse mem work in non-NUMA mode
@ 2009-05-12  3:55 Shaohua Li
  2009-05-12  7:59 ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Shaohua Li @ 2009-05-12  3:55 UTC (permalink / raw)
  To: lkml; +Cc: Yang, Sheng, Thomas Gleixner, H. Peter Anvin

With sparse, memory holes should not be marked present for memmap.
This patch makes sparse really works on non-NUMA mode.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Sheng Yang <sheng.yang@intel.com>

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 749559e..bc95c7a 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -761,15 +761,15 @@ void __init initmem_init(unsigned long start_pfn,
 	highstart_pfn = highend_pfn = max_pfn;
 	if (max_pfn > max_low_pfn)
 		highstart_pfn = max_low_pfn;
-	memory_present(0, 0, highend_pfn);
 	e820_register_active_regions(0, 0, highend_pfn);
+	sparse_memory_present_with_active_regions(0);
 	printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
 		pages_to_mb(highend_pfn - highstart_pfn));
 	num_physpages = highend_pfn;
 	high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
 #else
-	memory_present(0, 0, max_low_pfn);
 	e820_register_active_regions(0, 0, max_low_pfn);
+	sparse_memory_present_with_active_regions(0);
 	num_physpages = max_low_pfn;
 	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
 #endif
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 1753e80..dcf099c 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -638,7 +638,7 @@ void __init paging_init(void)
 	max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN;
 	max_zone_pfns[ZONE_NORMAL] = max_pfn;
 
-	memory_present(0, 0, max_pfn);
+	sparse_memory_present_with_active_regions(0);
 	sparse_init();
 	free_area_init_nodes(max_zone_pfns);
 }



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

* Re: [PATCH]X86: make sparse mem work in non-NUMA mode
  2009-05-12  3:55 [PATCH]X86: make sparse mem work in non-NUMA mode Shaohua Li
@ 2009-05-12  7:59 ` Ingo Molnar
  2009-05-12  8:40   ` Shaohua Li
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2009-05-12  7:59 UTC (permalink / raw)
  To: Shaohua Li; +Cc: lkml, Yang, Sheng, Thomas Gleixner, H. Peter Anvin


* Shaohua Li <shaohua.li@intel.com> wrote:

> With sparse, memory holes should not be marked present for memmap.
> This patch makes sparse really works on non-NUMA mode.
> 
> Signed-off-by: Shaohua Li <shaohua.li@intel.com>
> Signed-off-by: Sheng Yang <sheng.yang@intel.com>

It does not apply cleanly to the latest x86 tree:

  patching file arch/x86/mm/init_32.c
  Hunk #1 succeeded at 718 (offset -43 lines).
  patching file arch/x86/mm/init_64.c
  Hunk #1 FAILED at 638.
  1 out of 1 hunk FAILED -- rejects in file arch/x86/mm/init_64.c

Could you please send a patch against:

	http://people.redhat.com/mingo/tip.git/README

Thanks,

	Ingo

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

* Re: [PATCH]X86: make sparse mem work in non-NUMA mode
  2009-05-12  7:59 ` Ingo Molnar
@ 2009-05-12  8:40   ` Shaohua Li
  2009-05-12  9:32     ` [tip:x86/mm] x86: " tip-bot for Shaohua Li
  0 siblings, 1 reply; 4+ messages in thread
From: Shaohua Li @ 2009-05-12  8:40 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: lkml, Yang, Sheng, Thomas Gleixner, H. Peter Anvin

On Tue, 2009-05-12 at 15:59 +0800, Ingo Molnar wrote:
> * Shaohua Li <shaohua.li@intel.com> wrote:
> 
> > With sparse, memory holes should not be marked present for memmap.
> > This patch makes sparse really works on non-NUMA mode.
> > 
> > Signed-off-by: Shaohua Li <shaohua.li@intel.com>
> > Signed-off-by: Sheng Yang <sheng.yang@intel.com>
> 
> It does not apply cleanly to the latest x86 tree:
> 
>   patching file arch/x86/mm/init_32.c
>   Hunk #1 succeeded at 718 (offset -43 lines).
>   patching file arch/x86/mm/init_64.c
>   Hunk #1 FAILED at 638.
>   1 out of 1 hunk FAILED -- rejects in file arch/x86/mm/init_64.c
Looks the x64 code already has the fix.

With sparse, memory holes should not be marked present for memmap.
This patch makes sparse really works on SMP mode.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Sheng Yang <sheng.yang@intel.com>

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 9cdd9b0..5da919b 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -718,15 +718,15 @@ void __init initmem_init(unsigned long start_pfn,
 	highstart_pfn = highend_pfn = max_pfn;
 	if (max_pfn > max_low_pfn)
 		highstart_pfn = max_low_pfn;
-	memory_present(0, 0, highend_pfn);
 	e820_register_active_regions(0, 0, highend_pfn);
+	sparse_memory_present_with_active_regions(0);
 	printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
 		pages_to_mb(highend_pfn - highstart_pfn));
 	num_physpages = highend_pfn;
 	high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
 #else
-	memory_present(0, 0, max_low_pfn);
 	e820_register_active_regions(0, 0, max_low_pfn);
+	sparse_memory_present_with_active_regions(0);
 	num_physpages = max_low_pfn;
 	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
 #endif



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

* [tip:x86/mm] x86: make sparse mem work in non-NUMA mode
  2009-05-12  8:40   ` Shaohua Li
@ 2009-05-12  9:32     ` tip-bot for Shaohua Li
  0 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Shaohua Li @ 2009-05-12  9:32 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, sheng.yang, shaohua.li, tglx, mingo

Commit-ID:  ed077b58f6146684069975122b1728a9d248a501
Gitweb:     http://git.kernel.org/tip/ed077b58f6146684069975122b1728a9d248a501
Author:     Shaohua Li <shaohua.li@intel.com>
AuthorDate: Tue, 12 May 2009 16:40:00 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 12 May 2009 11:26:35 +0200

x86: make sparse mem work in non-NUMA mode

With sparse memory, holes should not be marked present for memmap.
This patch makes sure sparsemem really works on SMP mode (!NUMA).

[ Impact: use less memory to map fragmented RAM, avoid boot-OOM/crash ]

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Sheng Yang <sheng.yang@intel.com>
LKML-Reference: <1242117600.22431.0.camel@sli10-desk.sh.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 arch/x86/mm/init_32.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index fef1d90..949708d 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -706,15 +706,15 @@ void __init initmem_init(unsigned long start_pfn,
 	highstart_pfn = highend_pfn = max_pfn;
 	if (max_pfn > max_low_pfn)
 		highstart_pfn = max_low_pfn;
-	memory_present(0, 0, highend_pfn);
 	e820_register_active_regions(0, 0, highend_pfn);
+	sparse_memory_present_with_active_regions(0);
 	printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
 		pages_to_mb(highend_pfn - highstart_pfn));
 	num_physpages = highend_pfn;
 	high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
 #else
-	memory_present(0, 0, max_low_pfn);
 	e820_register_active_regions(0, 0, max_low_pfn);
+	sparse_memory_present_with_active_regions(0);
 	num_physpages = max_low_pfn;
 	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
 #endif

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

end of thread, other threads:[~2009-05-12  9:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-12  3:55 [PATCH]X86: make sparse mem work in non-NUMA mode Shaohua Li
2009-05-12  7:59 ` Ingo Molnar
2009-05-12  8:40   ` Shaohua Li
2009-05-12  9:32     ` [tip:x86/mm] x86: " tip-bot for Shaohua Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox