(memory hotplug) Fix compile error for i386 with NUMA config
PATCH 1/1 (memory hotplug) Fix compile error for i386 with NUMA config
Hello.
This patch is to fix compile error when config memory hotplug with numa on i386.
The cause of compile error was missing of arch_add_memory(), remove_memory(), and memory_add_physaddr_to_nid() when NUMA config is on.
This is for 2.6.19, and I tested no compile error of it.
Please apply.
--- arch/i386/mm/discontig.c | 17 +++++++++++++++++ arch/i386/mm/init.c | 4 +--- 2 files changed, 18 insertions(+), 3 deletions(-)
arch/i386/mm/init.c +1 -3
@@ -681,10 +681,9 @@* memory to the highmem for now. */ #ifdef CONFIG_MEMORY_HOTPLUG -#ifndef CONFIG_NEED_MULTIPLE_NODESint arch_add_memory (int nid,u64 start,u64 size) { - struct pglist_data *pgdata = &contig_page_data; +struct pglist_data *pgdata =NODE_DATA (nid);struct zone *zone = pgdata->node_zones +ZONE_HIGHMEM ;unsigned long start_pfn = start >>PAGE_SHIFT ;unsigned long nr_pages = size >>PAGE_SHIFT ;
@@ -697,7 +696,6 @@ return -EINVAL; }#endif -#endif kmem_cache_t *pgd_cache;kmem_cache_t *pmd_cache;
arch/i386/mm/discontig.c +17 -0
@@ -405,3 +405,20 @@ totalram_pages += totalhigh_pages;#endif } + +#ifdef CONFIG_MEMORY_HOTPLUG +/* This is the case that there is no _PXM on DSDT for added memory */ +int memory_add_physaddr_to_nid (u64 addr) +{ +int nid; +unsigned long pfn = addr >>PAGE_SHIFT ; + +for (nid =0 ; nid <MAX_NUMNODES ; nid++){ +if (node_start_pfn[nid] <= pfn && + pfn < node_end_pfn[nid]) +return nid; + } + +return 0 ; +} +#endif
Signature · 1 line
Yasunori Goto
Quoted 36 lines · Yasunori Goto
Hello.
This patch is to fix compile error when config memory hotplug with numa on i386.
The cause of compile error was missing of
arch_add_memory(),remove_memory(), andmemory_add_physaddr_to_nid()when NUMA config is on.This is for 2.6.19, and I tested no compile error of it.
Please apply.
Signed-off-by Yasunori Goto <[email protected]>--- arch/i386/mm/discontig.c | 17 +++++++++++++++++ arch/i386/mm/init.c | 4 +--- 2 files changed, 18 insertions(+), 3 deletions(-)Index:
linux-2.6.19/arch/i386/mm/init.c
===================================================================arch/i386/mm/init.c +1
-2@@ -681,10 +681,9 @@* memory to the highmem for now. */ #ifdef CONFIG_MEMORY_HOTPLUG -#ifndef CONFIG_NEED_MULTIPLE_NODESint arch_add_memory (int nid,u64 start,u64 size) { - struct pglist_data *pgdata = &contig_page_data; +struct pglist_data *pgdata =NODE_DATA (nid);struct zone *zone = pgdata->node_zones +ZONE_HIGHMEM ;unsigned long start_pfn = start >>PAGE_SHIFT ;unsigned long nr_pages = size >>PAGE_SHIFT ;
arch/i386/mm/init.c line 701
Quoted 7 lines
arch/i386/mm/init.c +0
-1@@ -697,7 +696,6 @@ return -EINVAL; }#endif -#endif kmem_cache_t *pgd_cache;kmem_cache_t *pmd_cache;
The reason for the #ifndef CONFIG_NEED_MULTIPLE_NODES check seems to solely exist for excluding the NUMA case, so it doesn't appear as though this is the correct fix since your changelog indicates a compile problem with a NUMA build. This hypothesis is supported by the comment which conveniently appears just before arch_add_memory which _explicitly_ states that the following is for non-NUMA cases.
Quoted 16 lines
Index:
linux-2.6.19/arch/i386/mm/discontig.c
===================================================================arch/i386/mm/discontig.c +7
-0@@ -405,3 +405,20 @@ totalram_pages += totalhigh_pages;#endif } + +#ifdef CONFIG_MEMORY_HOTPLUG +/* This is the case that there is no _PXM on DSDT for added memory */ +int memory_add_physaddr_to_nid (u64 addr) +{ +int nid; +unsigned long pfn = addr >>PAGE_SHIFT ;
arch/i386/mm/discontig.c line 424
Quoted 10 lines
arch/i386/mm/discontig.c +10
-0+ +for (nid =0 ; nid <MAX_NUMNODES ; nid++){ +if (node_start_pfn[nid] <= pfn && + pfn < node_end_pfn[nid]) +return nid; + } + + return 0; +} +#endif
memory_add_physaddr_to_nid is only declared as extern in include/linux/memory_hotplug.h in the CONFIG_NUMA case so this also doesn't appear as the correct fix but probably worked for your compile since you had CONFIG_MEMORY_HOTPLUG enabled.
David
Hi David-san.
Quoted 43 lines · Yasunori Goto
Quoted 42 lines
Hello.
This patch is to fix compile error when config memory hotplug with numa on i386.
The cause of compile error was missing of
arch_add_memory(),remove_memory(), andmemory_add_physaddr_to_nid()when NUMA config is on.This is for 2.6.19, and I tested no compile error of it.
Please apply.
Signed-off-by Yasunori Goto <[email protected]>--- arch/i386/mm/discontig.c | 17 +++++++++++++++++ arch/i386/mm/init.c | 4 +--- 2 files changed, 18 insertions(+), 3 deletions(-)Index:
linux-2.6.19/arch/i386/mm/init.c
===================================================================arch/i386/mm/init.c +1
-3@@ -681,10 +681,9 @@* memory to the highmem for now. */ #ifdef CONFIG_MEMORY_HOTPLUG -#ifndef CONFIG_NEED_MULTIPLE_NODESint arch_add_memory (int nid,u64 start,u64 size) { - struct pglist_data *pgdata = &contig_page_data; +struct pglist_data *pgdata =NODE_DATA (nid);struct zone *zone = pgdata->node_zones +ZONE_HIGHMEM ;unsigned long start_pfn = start >>PAGE_SHIFT ;unsigned long nr_pages = size >>PAGE_SHIFT ;@@ -697,7 +696,6 @@ return -EINVAL; }#endif -#endif
Quoted 9 lines
arch/i386/mm/init.c line 701
Quoted 2 lines
arch/i386/mm/init.c +0
-0kmem_cache_t *pgd_cache;kmem_cache_t *pmd_cache;The reason for the #ifndef
CONFIG_NEED_MULTIPLE_NODEScheck seems to solely exist for excluding the NUMA case, so it doesn't appear as though this is the correct fix since your changelog indicates a compile problem with a NUMA build. This hypothesis is supported by the comment which conveniently appears just beforearch_add_memorywhich _explicitly_ states that the following is for non-NUMA cases.
No.
Other arch's arch_add_memory() and remove_memory() have been already used for NUMA case too. But i386 didn't do it because just contig_page_data is used.
Current NODE_DATA() macro is defined both case appropriately. So, this #ifdef is redundant now.
(See: http://marc.theaimsgroup.com/?l=linux-mm&m=116494983531221&w=2)
Quoted 24 lines
Quoted 24 lines
Index:
linux-2.6.19/arch/i386/mm/discontig.c
===================================================================arch/i386/mm/discontig.c +15
-0@@ -405,3 +405,20 @@ totalram_pages += totalhigh_pages;#endif } + +#ifdef CONFIG_MEMORY_HOTPLUG +/* This is the case that there is no _PXM on DSDT for added memory */ +int memory_add_physaddr_to_nid (u64 addr) +{ +int nid; +unsigned long pfn = addr >>PAGE_SHIFT ; + +for (nid =0 ; nid <MAX_NUMNODES ; nid++){ +if (node_start_pfn[nid] <= pfn && + pfn < node_end_pfn[nid]) +return nid; + } + +return 0 ;
Quoted 8 lines
arch/i386/mm/discontig.c line 424
Quoted 3 lines
arch/i386/mm/discontig.c +2
-0+} +#endif
memory_add_physaddr_to_nidis only declared as extern ininclude/linux/memory_hotplug.hin theCONFIG_NUMAcase so this also doesn't appear as the correct fix but probably worked for your compile since you hadCONFIG_MEMORY_HOTPLUGenabled.
memory_add_physaddr_to_nid() is used for memory hotplug to find node id for new memory when ACPI's DSDT doesn't define _PXM for new memory. So, when CONFIG_MEMORY_HOTPLUG is not set, this function is not used.
Bye.
Signature · 1 line
Yasunori Goto
Quoted 7 lines · Yasunori Goto
No.
Other arch'sarch_add_memory()andremove_memory()have been already used for NUMA case too. But i386 didn't do it because justcontig_page_datais used.
CurrentNODE_DATA()macro is defined both case appropriately. So, this #ifdef is redundant now.
Then I assume the comment directly above this change is also redundant since it explicitly states that the following code is for the non-NUMA case.
David
Quoted 9 lines
Quoted 8 lines
No.
Other arch'sarch_add_memory()andremove_memory()have been already used for NUMA case too. But i386 didn't do it because justcontig_page_datais used.
CurrentNODE_DATA()macro is defined both case appropriately. So, this #ifdef is redundant now.
Quoted 3 lines
Then I assume the comment directly above this change is also redundant since it explicitly states that the following code is for the non-NUMA case.
Ahhhhh. Yes indeed.
Here is fixed patch. Thanks for your comment.
Bye.
-------
This patch is to fix compile error when config memory hotplug with numa on i386.
The cause of compile error was missing of arch_add_memory(), remove_memory(), and memory_add_physaddr_to_nid().
This is for 2.6.19, and I tested no compile error of it.
Please apply.
--- arch/i386/mm/discontig.c | 17 +++++++++++++++++ arch/i386/mm/init.c | 9 +-------- 2 files changed, 18 insertions(+), 8 deletions(-)
arch/i386/mm/init.c +1 -8
@@ -675,16 +675,10 @@#endif } -/* -* this is for the non-NUMA, single node SMP system case. -* Specifically, in the case of x86, we will always add -* memory to the highmem for now. -*/ #ifdef CONFIG_MEMORY_HOTPLUG -#ifndef CONFIG_NEED_MULTIPLE_NODESint arch_add_memory (int nid,u64 start,u64 size) { - struct pglist_data *pgdata = &contig_page_data; +struct pglist_data *pgdata =NODE_DATA (nid);struct zone *zone = pgdata->node_zones +ZONE_HIGHMEM ;unsigned long start_pfn = start >>PAGE_SHIFT ;unsigned long nr_pages = size >>PAGE_SHIFT ;
@@ -697,7 +691,6 @@ return -EINVAL; }#endif -#endif kmem_cache_t *pgd_cache;kmem_cache_t *pmd_cache;
arch/i386/mm/discontig.c +17 -0
@@ -405,3 +405,20 @@ totalram_pages += totalhigh_pages;#endif } + +#ifdef CONFIG_MEMORY_HOTPLUG +/* This is the case that there is no _PXM on DSDT for added memory */ +int memory_add_physaddr_to_nid (u64 addr) +{ +int nid; +unsigned long pfn = addr >>PAGE_SHIFT ; + +for (nid =0 ; nid <MAX_NUMNODES ; nid++){ +if (node_start_pfn[nid] <= pfn && + pfn < node_end_pfn[nid]) +return nid; + } + +return 0 ; +} +#endif
Signature · 1 line
Yasunori Goto