public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Miller <davem@davemloft.net>,
	Be
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH 7/8] early_res: prepare for other platform to use it
Date: Wed, 24 Mar 2010 03:34:20 -0700	[thread overview]
Message-ID: <1269426861-20903-8-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <1269426861-20903-1-git-send-email-yinghai@kernel.org>

From: Yinghai Lu <yinghai@@kernel.org>

add weak reserver_bootmem_generic()

also clean up x86 64 bit one.

add include for linux/early_res.h

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 arch/x86/mm/init_32.c |    5 -----
 arch/x86/mm/init_64.c |   18 ------------------
 mm/bootmem.c          |    7 +++++++
 mm/page_alloc.c       |    1 +
 4 files changed, 8 insertions(+), 23 deletions(-)

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index a7625d5..16001e1 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -1070,8 +1070,3 @@ void mark_rodata_ro(void)
 }
 #endif
 
-int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
-				   int flags)
-{
-	return reserve_bootmem(phys, len, flags);
-}
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index dd88ef9..cc3627b 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -801,10 +801,6 @@ void mark_rodata_ro(void)
 int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
 				   int flags)
 {
-#ifdef CONFIG_NUMA
-	int nid, next_nid;
-	int ret;
-#endif
 	unsigned long pfn = phys >> PAGE_SHIFT;
 
 	if (pfn >= max_pfn) {
@@ -820,21 +816,7 @@ int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
 		return -EFAULT;
 	}
 
-	/* Should check here against the e820 map to avoid double free */
-#ifdef CONFIG_NUMA
-	nid = phys_to_nid(phys);
-	next_nid = phys_to_nid(phys + len - 1);
-	if (nid == next_nid)
-		ret = reserve_bootmem_node(NODE_DATA(nid), phys, len, flags);
-	else
-		ret = reserve_bootmem(phys, len, flags);
-
-	if (ret != 0)
-		return ret;
-
-#else
 	reserve_bootmem(phys, len, flags);
-#endif
 
 	if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
 		dma_reserve += len / PAGE_SIZE;
diff --git a/mm/bootmem.c b/mm/bootmem.c
index d7c791e..760c279 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/kmemleak.h>
 #include <linux/range.h>
+#include <linux/early_res.h>
 
 #include <asm/bug.h>
 #include <asm/io.h>
@@ -525,6 +526,12 @@ int __init reserve_bootmem(unsigned long addr, unsigned long size,
 }
 
 #ifndef CONFIG_NO_BOOTMEM
+int __weak __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
+				   int flags)
+{
+	return reserve_bootmem(phys, len, flags);
+}
+
 static unsigned long __init align_idx(struct bootmem_data *bdata,
 				      unsigned long idx, unsigned long step)
 {
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 04c241a..e7b1d72 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -21,6 +21,7 @@
 #include <linux/pagemap.h>
 #include <linux/jiffies.h>
 #include <linux/bootmem.h>
+#include <linux/early_res.h>
 #include <linux/compiler.h>
 #include <linux/kernel.h>
 #include <linux/kmemcheck.h>
-- 
1.6.4.2

WARNING: multiple messages have this Message-ID (diff)
From: Yinghai Lu <yinghai@kernel.org>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Miller <davem@davemloft.net>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH 7/8] early_res: prepare for other platform to use it
Date: Wed, 24 Mar 2010 03:34:20 -0700	[thread overview]
Message-ID: <1269426861-20903-8-git-send-email-yinghai@kernel.org> (raw)
Message-ID: <20100324103420.6DPmipaz2WLC31iu50Av4Dtr_x3QorrUORqblBfkwBM@z> (raw)
In-Reply-To: <1269426861-20903-1-git-send-email-yinghai@kernel.org>

From: Yinghai Lu <yinghai@@kernel.org>

add weak reserver_bootmem_generic()

also clean up x86 64 bit one.

add include for linux/early_res.h

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 arch/x86/mm/init_32.c |    5 -----
 arch/x86/mm/init_64.c |   18 ------------------
 mm/bootmem.c          |    7 +++++++
 mm/page_alloc.c       |    1 +
 4 files changed, 8 insertions(+), 23 deletions(-)

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index a7625d5..16001e1 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -1070,8 +1070,3 @@ void mark_rodata_ro(void)
 }
 #endif
 
-int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
-				   int flags)
-{
-	return reserve_bootmem(phys, len, flags);
-}
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index dd88ef9..cc3627b 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -801,10 +801,6 @@ void mark_rodata_ro(void)
 int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
 				   int flags)
 {
-#ifdef CONFIG_NUMA
-	int nid, next_nid;
-	int ret;
-#endif
 	unsigned long pfn = phys >> PAGE_SHIFT;
 
 	if (pfn >= max_pfn) {
@@ -820,21 +816,7 @@ int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
 		return -EFAULT;
 	}
 
-	/* Should check here against the e820 map to avoid double free */
-#ifdef CONFIG_NUMA
-	nid = phys_to_nid(phys);
-	next_nid = phys_to_nid(phys + len - 1);
-	if (nid == next_nid)
-		ret = reserve_bootmem_node(NODE_DATA(nid), phys, len, flags);
-	else
-		ret = reserve_bootmem(phys, len, flags);
-
-	if (ret != 0)
-		return ret;
-
-#else
 	reserve_bootmem(phys, len, flags);
-#endif
 
 	if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
 		dma_reserve += len / PAGE_SIZE;
diff --git a/mm/bootmem.c b/mm/bootmem.c
index d7c791e..760c279 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/kmemleak.h>
 #include <linux/range.h>
+#include <linux/early_res.h>
 
 #include <asm/bug.h>
 #include <asm/io.h>
@@ -525,6 +526,12 @@ int __init reserve_bootmem(unsigned long addr, unsigned long size,
 }
 
 #ifndef CONFIG_NO_BOOTMEM
+int __weak __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
+				   int flags)
+{
+	return reserve_bootmem(phys, len, flags);
+}
+
 static unsigned long __init align_idx(struct bootmem_data *bdata,
 				      unsigned long idx, unsigned long step)
 {
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 04c241a..e7b1d72 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -21,6 +21,7 @@
 #include <linux/pagemap.h>
 #include <linux/jiffies.h>
 #include <linux/bootmem.h>
+#include <linux/early_res.h>
 #include <linux/compiler.h>
 #include <linux/kernel.h>
 #include <linux/kmemcheck.h>
-- 
1.6.4.2


  parent reply	other threads:[~2010-03-24 10:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-24 10:34 [PATCH -v4 00/08] use lmb with x86 Yinghai Lu
2010-03-24 10:34 ` Yinghai Lu
2010-03-24 10:34 ` [PATCH 1/8] x86: do not free zero sized per cpu areas Yinghai Lu
2010-03-24 10:34   ` Yinghai Lu
2010-03-24 10:34 ` [PATCH 2/8] x86: add find_e820_area_node Yinghai Lu
2010-03-24 10:34   ` Yinghai Lu
2010-03-24 10:34 ` [PATCH 3/8] x86: add sanitize_e820_map Yinghai Lu
2010-03-24 10:34   ` Yinghai Lu
2010-03-24 10:34 ` [PATCH 4/8] lmb: seperate region array from lmb_region struct Yinghai Lu
2010-03-24 10:34   ` Yinghai Lu
2010-03-24 10:34 ` [PATCH 5/8] x86: use lmb to replace early_res Yinghai Lu
2010-03-24 10:34   ` Yinghai Lu
2010-03-24 10:34 ` [PATCH 6/8] x86: remove find_e820_area Yinghai Lu
2010-03-24 10:34   ` Yinghai Lu
2010-03-24 10:34 ` Yinghai Lu [this message]
2010-03-24 10:34   ` [PATCH 7/8] early_res: prepare for other platform to use it Yinghai Lu
2010-03-24 10:34 ` [PATCH 8/8] powerpc : use early_res/nobootmem Yinghai Lu
2010-03-24 10:34   ` Yinghai Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1269426861-20903-8-git-send-email-yinghai@kernel.org \
    --to=yinghai@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=hpa@zytor.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox