Commit 4942e998b40b8f6080930ec16442444e9930aee5
Committed by
Linus Torvalds
1 parent
71efa8fdc5
Exists in
master
and in
20 other branches
[PATCH] hot-add-mem x86_64: memory_add_physaddr_to_nid enable
The api for hot-add memory already has a construct for finding nodes based on an address, memory_add_physaddr_to_nid. This patch allows the fucntion to do something besides return 0. It uses the nodes_add infomation to lookup to node info for a hot add event. Signed-off-by: Keith Mannthey <kmannth@us.ibm.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Andi Kleen <ak@muc.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 2 changed files with 19 additions and 14 deletions Side-by-side Diff
arch/x86_64/mm/init.c
... | ... | @@ -463,19 +463,6 @@ |
463 | 463 | |
464 | 464 | #ifdef CONFIG_MEMORY_HOTPLUG |
465 | 465 | /* |
466 | - * XXX: memory_add_physaddr_to_nid() is to find node id from physical address | |
467 | - * via probe interface of sysfs. If acpi notifies hot-add event, then it | |
468 | - * can tell node id by searching dsdt. But, probe interface doesn't have | |
469 | - * node id. So, return 0 as node id at this time. | |
470 | - */ | |
471 | -#ifdef CONFIG_NUMA | |
472 | -int memory_add_physaddr_to_nid(u64 start) | |
473 | -{ | |
474 | - return 0; | |
475 | -} | |
476 | -#endif | |
477 | - | |
478 | -/* | |
479 | 466 | * Memory is added always to NORMAL zone. This means you will never get |
480 | 467 | * additional DMA/DMA32 memory. |
481 | 468 | */ |
... | ... | @@ -505,6 +492,13 @@ |
505 | 492 | return -EINVAL; |
506 | 493 | } |
507 | 494 | EXPORT_SYMBOL_GPL(remove_memory); |
495 | + | |
496 | +#ifndef CONFIG_ACPI_NUMA | |
497 | +int memory_add_physaddr_to_nid(u64 start) | |
498 | +{ | |
499 | + return 0; | |
500 | +} | |
501 | +#endif | |
508 | 502 | |
509 | 503 | #else /* CONFIG_MEMORY_HOTPLUG */ |
510 | 504 | /* |
arch/x86_64/mm/srat.c
... | ... | @@ -27,7 +27,7 @@ |
27 | 27 | |
28 | 28 | static nodemask_t nodes_parsed __initdata; |
29 | 29 | static struct bootnode nodes[MAX_NUMNODES] __initdata; |
30 | -static struct bootnode nodes_add[MAX_NUMNODES] __initdata; | |
30 | +static struct bootnode nodes_add[MAX_NUMNODES]; | |
31 | 31 | static int found_add_area __initdata; |
32 | 32 | int hotadd_percent __initdata = 0; |
33 | 33 | |
... | ... | @@ -466,4 +466,15 @@ |
466 | 466 | } |
467 | 467 | |
468 | 468 | EXPORT_SYMBOL(__node_distance); |
469 | + | |
470 | +int memory_add_physaddr_to_nid(u64 start) | |
471 | +{ | |
472 | + int i, ret = 0; | |
473 | + | |
474 | + for_each_node(i) | |
475 | + if (nodes_add[i].start <= start && nodes_add[i].end > start) | |
476 | + ret = i; | |
477 | + | |
478 | + return ret; | |
479 | +} |