From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: Andrew Morton <akpm@osdl.org>
Cc: haveblue@us.ibm.com, apw@shadowen.org, cbe-oss-dev@ozlabs.org,
linuxppc-dev@ozlabs.org, linux-mm@kvack.org, mkravetz@us.ibm.com,
hch@infradead.org, jk@ozlabs.org, linux-kernel@vger.kernel.org,
paulus@samba.org, benh@kernel.crashing.org, gone@us.ibm.com,
kmannth@us.ibm.com
Subject: Re: [PATCH] Fix sparsemem on Cell
Date: Sat, 16 Dec 2006 17:03:53 +0900 [thread overview]
Message-ID: <20061216170353.2dfa27b1.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20061215114536.dc5c93af.akpm@osdl.org>
On Fri, 15 Dec 2006 11:45:36 -0800
Andrew Morton <akpm@osdl.org> wrote:
> Perhaps if the function's role in the world was commented it would be clearer.
>
How about patch like this ? (this one is not tested.)
Already-exisiting-more-generic-flag is available ?
-Kame
==
include/linux/memory_hotplug.h | 8 ++++++++
mm/memory_hotplug.c | 14 ++++++++++++++
mm/page_alloc.c | 11 +++++++----
3 files changed, 29 insertions(+), 4 deletions(-)
Index: linux-2.6.20-rc1-mm1/include/linux/memory_hotplug.h
===================================================================
--- linux-2.6.20-rc1-mm1.orig/include/linux/memory_hotplug.h 2006-11-30 06:57:37.000000000 +0900
+++ linux-2.6.20-rc1-mm1/include/linux/memory_hotplug.h 2006-12-16 16:42:40.000000000 +0900
@@ -133,6 +133,10 @@
#endif /* CONFIG_NUMA */
#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
+extern int under_memory_hotadd(void);
+
+
+
#else /* ! CONFIG_MEMORY_HOTPLUG */
/*
* Stub functions for when hotplug is off
@@ -159,6 +163,10 @@
dump_stack();
return -ENOSYS;
}
+static inline int under_memory_hotadd()
+{
+ return 0;
+}
#endif /* ! CONFIG_MEMORY_HOTPLUG */
static inline int __remove_pages(struct zone *zone, unsigned long start_pfn,
Index: linux-2.6.20-rc1-mm1/mm/memory_hotplug.c
===================================================================
--- linux-2.6.20-rc1-mm1.orig/mm/memory_hotplug.c 2006-12-16 14:24:10.000000000 +0900
+++ linux-2.6.20-rc1-mm1/mm/memory_hotplug.c 2006-12-16 16:51:08.000000000 +0900
@@ -26,6 +26,17 @@
#include <asm/tlbflush.h>
+/*
+ * Because memory hotplug shares some codes for initilization with boot,
+ * we sometimes have to check what we are doing ?
+ */
+static atomic_t memory_hotadd_count;
+
+int under_memory_hotadd(void)
+{
+ return atomic_read(&memory_hotadd_count);
+}
+
/* add this memory to iomem resource */
static struct resource *register_memory_resource(u64 start, u64 size)
{
@@ -273,10 +284,13 @@
if (ret)
goto error;
}
+ atomic_inc(&memory_hotadd_count);
/* call arch's memory hotadd */
ret = arch_add_memory(nid, start, size);
+ atomic_dec(&memory_hotadd_count);
+
if (ret < 0)
goto error;
Index: linux-2.6.20-rc1-mm1/mm/page_alloc.c
===================================================================
--- linux-2.6.20-rc1-mm1.orig/mm/page_alloc.c 2006-12-16 14:24:38.000000000 +0900
+++ linux-2.6.20-rc1-mm1/mm/page_alloc.c 2006-12-16 16:53:02.000000000 +0900
@@ -2069,10 +2069,13 @@
unsigned long pfn;
for (pfn = start_pfn; pfn < end_pfn; pfn++) {
- if (!early_pfn_valid(pfn))
- continue;
- if (!early_pfn_in_nid(pfn, nid))
- continue;
+ if (!under_memory_hotadd()) {
+ /* we are in boot */
+ if (!early_pfn_valid(pfn))
+ continue;
+ if (!early_pfn_in_nid(pfn, nid))
+ continue;
+ }
page = pfn_to_page(pfn);
set_page_links(page, zone, nid, pfn);
init_page_count(page);
--
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>
next prev parent reply other threads:[~2006-12-16 8:03 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-15 16:53 Dave Hansen
2006-12-15 17:11 ` Andy Whitcroft
2006-12-15 17:24 ` Dave Hansen
2006-12-15 19:45 ` Andrew Morton
2006-12-16 8:03 ` KAMEZAWA Hiroyuki [this message]
2006-12-18 21:13 ` Dave Hansen
2006-12-18 22:15 ` Christoph Hellwig
2006-12-18 22:54 ` Arnd Bergmann
2006-12-18 23:16 ` Dave Hansen
2006-12-19 0:16 ` KAMEZAWA Hiroyuki
2006-12-19 8:59 ` Arnd Bergmann
2006-12-19 19:34 ` Dave Hansen
2007-01-06 1:10 ` [PATCH] Fix sparsemem on Cell (take 3) Dave Hansen
2007-01-06 4:52 ` John Rose
2007-01-07 8:58 ` Dave Hansen
2007-01-07 12:07 ` Arnd Bergmann
2007-01-08 6:31 ` Tim Pepper
2007-01-08 6:47 ` Tim Pepper
2006-12-15 17:22 ` [PATCH] Fix sparsemem on Cell Michael Buesch
2006-12-15 17:57 ` Dave Hansen
2006-12-15 20:21 ` Benjamin Herrenschmidt
2006-12-15 17:14 Dave Hansen
2006-12-17 23:02 ` Arnd Bergmann
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=20061216170353.2dfa27b1.kamezawa.hiroyu@jp.fujitsu.com \
--to=kamezawa.hiroyu@jp.fujitsu.com \
--cc=akpm@osdl.org \
--cc=apw@shadowen.org \
--cc=benh@kernel.crashing.org \
--cc=cbe-oss-dev@ozlabs.org \
--cc=gone@us.ibm.com \
--cc=haveblue@us.ibm.com \
--cc=hch@infradead.org \
--cc=jk@ozlabs.org \
--cc=kmannth@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=mkravetz@us.ibm.com \
--cc=paulus@samba.org \
/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