linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH: 003/017]Memory hotplug for new nodes v.4.(get node id at probe memory)
@ 2006-03-17  8:20 Yasunori Goto
  2006-03-22 13:17 ` Andi Kleen
  0 siblings, 1 reply; 2+ messages in thread
From: Yasunori Goto @ 2006-03-17  8:20 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Luck, Tony, Andi Kleen, Linux Kernel ML, linux-ia64, linux-mm

When CONFIG_NUMA && CONFIG_ARCH_MEMORY_PROBE, nid should be defined
before calling add_memory(nid, start, size).

Each arch , which supports CONFIG_NUMA && ARCH_MEMORY_PROBE, should
define arch_nid_probe(paddr);

Powerpc has nice function. X86_64 has not.....

Note:
If memory is hot-plugged by firmware, there is another *good* information
like pxm.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>

 arch/powerpc/mm/mem.c          |    5 +++++
 drivers/base/memory.c          |    3 ++-
 include/linux/memory_hotplug.h |    9 +++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

Index: pgdat8/arch/powerpc/mm/mem.c
===================================================================
--- pgdat8.orig/arch/powerpc/mm/mem.c	2006-03-17 13:48:31.665710185 +0900
+++ pgdat8/arch/powerpc/mm/mem.c	2006-03-17 13:52:47.538753925 +0900
@@ -114,6 +114,11 @@ void online_page(struct page *page)
 	num_physpages++;
 }
 
+int arch_nid_probe(u64 start)
+{
+	return hot_add_scn_to_nid(start);
+}
+
 int __meminit arch_add_memory(int nid, u64 start, u64 size)
 {
 	struct pglist_data *pgdata;
Index: pgdat8/include/linux/memory_hotplug.h
===================================================================
--- pgdat8.orig/include/linux/memory_hotplug.h	2006-03-17 13:48:31.626647685 +0900
+++ pgdat8/include/linux/memory_hotplug.h	2006-03-17 13:51:28.325864271 +0900
@@ -66,6 +66,15 @@ extern int online_pages(unsigned long, u
 /* reasonably generic interface to expand the physical pages in a zone  */
 extern int __add_pages(struct zone *zone, unsigned long start_pfn,
 	unsigned long nr_pages);
+#if defined(CONFIG_NUMA) && defined(CONFIG_ARCH_MEMORY_PROBE)
+extern int arch_nid_probe(u64 start);
+#else
+static inline int arch_nid_probe(u64 start)
+{
+	return 0;
+}
+#endif
+
 #else /* ! CONFIG_MEMORY_HOTPLUG */
 /*
  * Stub functions for when hotplug is off
Index: pgdat8/drivers/base/memory.c
===================================================================
--- pgdat8.orig/drivers/base/memory.c	2006-03-17 13:47:31.558289046 +0900
+++ pgdat8/drivers/base/memory.c	2006-03-17 13:51:28.326840833 +0900
@@ -310,7 +310,8 @@ memory_probe_store(struct class *class, 
 
 	phys_addr = simple_strtoull(buf, NULL, 0);
 
-	ret = add_memory(phys_addr, PAGES_PER_SECTION << PAGE_SHIFT);
+	ret = add_memory(arch_nid_probe(phys_addr),
+			 phys_addr, PAGES_PER_SECTION << PAGE_SHIFT);
 
 	if (ret)
 		count = ret;

-- 
Yasunori Goto 


--
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] 2+ messages in thread

* Re: [PATCH: 003/017]Memory hotplug for new nodes v.4.(get node id at probe memory)
  2006-03-17  8:20 [PATCH: 003/017]Memory hotplug for new nodes v.4.(get node id at probe memory) Yasunori Goto
@ 2006-03-22 13:17 ` Andi Kleen
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2006-03-22 13:17 UTC (permalink / raw)
  To: Yasunori Goto
  Cc: Andrew Morton, Luck, Tony, Linux Kernel ML, linux-ia64, linux-mm

On Friday 17 March 2006 09:20, Yasunori Goto wrote:
> When CONFIG_NUMA && CONFIG_ARCH_MEMORY_PROBE, nid should be defined
> before calling add_memory(nid, start, size).

Seems a bit weird to have the node number assignment somewhere
hidden in memory hotadd. It would be probably cleaner to have
a separate step for this.

> +#if defined(CONFIG_NUMA) && defined(CONFIG_ARCH_MEMORY_PROBE)
> +extern int arch_nid_probe(u64 start);

Instead of adding such ugly ifdefs better just add stubs to all the
architectures that support memory hotplug. There are not that many
anyways.

-Andi

> +#else
> +static inline int arch_nid_probe(u64 start)
> +{
> +	return 0;
> +}
> +#endif
> +

--
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] 2+ messages in thread

end of thread, other threads:[~2006-03-22 13:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-17  8:20 [PATCH: 003/017]Memory hotplug for new nodes v.4.(get node id at probe memory) Yasunori Goto
2006-03-22 13:17 ` Andi Kleen

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