x86/mm/numa: fix becoming single node on numa machine with 32-bit kernel.
PATCH 1/1 x86/mm/numa: fix becoming single node on numa machine with 32-bit kernel.
On numa machine, if a 32-bit kernel runs over it, node data cannot be allocated from local node if the account of memory for node 0 covers the low memory space entirely:
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x83fffffff] [ 0.000000] NODE_DATA [mem 0x367ed000-0x367edfff] [ 0.000000] Initmem setup node 1 [mem 0x840000000-0xfffffffff] [ 0.000000] Cannot find 4096 bytes in node 1 [ 0.000000] 64664MB HIGHMEM available. [ 0.000000] 871MB LOWMEM available.
To fix this issue, node data is allowed to be allocated from other nodes if the memory of local node is still not mapped. The expected result looks like this:
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x83fffffff] [ 0.000000] NODE_DATA [mem 0x367ed000-0x367edfff] [ 0.000000] Initmem setup node 1 [mem 0x840000000-0xfffffffff] [ 0.000000] NODE_DATA [mem 0x367ec000-0x367ecfff] [ 0.000000] NODE_DATA(1) on node 0 [ 0.000000] 64664MB HIGHMEM available. [ 0.000000] 871MB LOWMEM available.
--- arch/x86/mm/numa.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
arch/x86/mm/numa.c +7 -3
@@ -211,9 +211,13 @@ static void __init setup_node_data(int nid, u64 start, u64 end)*/ nd_pa =memblock_alloc_nid (nd_size,SMP_CACHE_BYTES , nid);if (!nd_pa) { -pr_err ("Cannot find %zu bytes in node %d\n" , - nd_size, nid); -return ; + nd_pa =__memblock_alloc_base (nd_size,SMP_CACHE_BYTES , +MEMBLOCK_ALLOC_ACCESSIBLE ); +if (!nd_pa) { +pr_err ("Cannot find %zu bytes in node %d\n" , + nd_size, nid); +return ; + } } nd =__va (nd_pa);
Signature · 1 line
1.7.8.110.g4cb5d
Quoted 2 lines · Lans Zhang
Signed-off-by Lans Zhang <[email protected]>
Patch looks good to me.
-Andi
Signature · 1 line
[email protected] -- Speaking for myself only
tip-bot for Lans Zhang
merge bot[tip:x86/mm] x86/mm/numa: Fix 32-bit kernel NUMA boot
In reply to Lans Zhangx86/mm/numa: Fix 32-bit kernel NUMA boot
Commit-ID: f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4 Gitweb: http://git.kernel.org/tip/f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4 Author: Lans Zhang <[email protected]> AuthorDate: Fri, 6 Dec 2013 12:18:30 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 19 Dec 2013 13:58:36 +0100
x86/mm/numa: Fix 32-bit kernel NUMA boot
When booting a 32-bit x86 kernel on a NUMA machine, node data cannot be allocated from local node if the account of memory for node 0 covers the low memory space entirely:
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x83fffffff] [ 0.000000] NODE_DATA [mem 0x367ed000-0x367edfff] [ 0.000000] Initmem setup node 1 [mem 0x840000000-0xfffffffff] [ 0.000000] Cannot find 4096 bytes in node 1 [ 0.000000] 64664MB HIGHMEM available. [ 0.000000] 871MB LOWMEM available.
To fix this issue, node data is allowed to be allocated from other nodes if the memory of local node is still not mapped. The expected result looks like this:
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x83fffffff] [ 0.000000] NODE_DATA [mem 0x367ed000-0x367edfff] [ 0.000000] Initmem setup node 1 [mem 0x840000000-0xfffffffff] [ 0.000000] NODE_DATA [mem 0x367ec000-0x367ecfff] [ 0.000000] NODE_DATA(1) on node 0 [ 0.000000] 64664MB HIGHMEM available. [ 0.000000] 871MB LOWMEM available.
--- arch/x86/mm/numa.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/x86/mm/numa.c +7 -3
@@ -211,9 +211,13 @@ static void __init setup_node_data(int nid, u64 start, u64 end)*/ nd_pa =memblock_alloc_nid (nd_size,SMP_CACHE_BYTES , nid);if (!nd_pa) { -pr_err ("Cannot find %zu bytes in node %d\n" , - nd_size, nid); -return ; + nd_pa =__memblock_alloc_base (nd_size,SMP_CACHE_BYTES , +MEMBLOCK_ALLOC_ACCESSIBLE ); +if (!nd_pa) { +pr_err ("Cannot find %zu bytes in node %d\n" , + nd_size, nid); +return ; + } } nd =__va (nd_pa);
Re: [tip:x86/mm] x86/mm/numa: Fix 32-bit kernel NUMA boot
Quoted 52 lines · tip-bot for Lans Zhang
Commit-ID: f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4 Gitweb: http://git.kernel.org/tip/f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4 Author: Lans Zhang <[email protected]> AuthorDate: Fri, 6 Dec 2013 12:18:30 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 19 Dec 2013 13:58:36 +0100x86/mm/numa: Fix 32-bit kernel NUMA boot
When booting a 32-bit x86 kernel on a NUMA machine, node data cannot be allocated from local node if the account of memory for node 0 covers the low memory space entirely:
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x83fffffff] [ 0.000000] NODE_DATA [mem 0x367ed000-0x367edfff] [ 0.000000] Initmem setup node 1 [mem 0x840000000-0xfffffffff] [ 0.000000] Cannot find 4096 bytes in node 1 [ 0.000000] 64664MB HIGHMEM available. [ 0.000000] 871MB LOWMEM available.To fix this issue, node data is allowed to be allocated from other nodes if the memory of local node is still not mapped. The expected result looks like this:
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x83fffffff] [ 0.000000] NODE_DATA [mem 0x367ed000-0x367edfff] [ 0.000000] Initmem setup node 1 [mem 0x840000000-0xfffffffff] [ 0.000000] NODE_DATA [mem 0x367ec000-0x367ecfff] [ 0.000000] NODE_DATA(1) on node 0 [ 0.000000] 64664MB HIGHMEM available. [ 0.000000] 871MB LOWMEM available.Signed-off-by Lans Zhang <[email protected]>Cc <[email protected]>Cc Yinghai Lu <[email protected]>Signed-off-by Ingo Molnar <[email protected]>--- arch/x86/mm/numa.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)arch/x86/mm/numa.c +0
-3@@ -211,9 +211,13 @@ static void __init setup_node_data(int nid, u64 start, u64 end)*/ nd_pa =memblock_alloc_nid (nd_size,SMP_CACHE_BYTES , nid);if (!nd_pa) { -pr_err ("Cannot find %zu bytes in node %d\n" , - nd_size, nid); -return ;
arch/x86/mm/numa.c static void __init setup_node_data(int nid, u64 start, u64 end) · line 223
Quoted 10 lines
arch/x86/mm/numa.c +7
-0+ nd_pa =__memblock_alloc_base (nd_size,SMP_CACHE_BYTES , +MEMBLOCK_ALLOC_ACCESSIBLE ); +if (!nd_pa) { +pr_err ("Cannot find %zu bytes in node %d\n" , + nd_size, nid); +return ; + } } nd =__va (nd_pa);
Can you just use memblock_alloc_try_nid instead memblock_alloc_nid?
Thanks
Yinghai
Re: [tip:x86/mm] x86/mm/numa: Fix 32-bit kernel NUMA boot
Quoted 58 lines · Yinghai Lu
Quoted 56 lines · tip-bot for Lans Zhang
Commit-ID: f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4 Gitweb: http://git.kernel.org/tip/f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4 Author: Lans Zhang<[email protected]> AuthorDate: Fri, 6 Dec 2013 12:18:30 +0800 Committer: Ingo Molnar<[email protected]> CommitDate: Thu, 19 Dec 2013 13:58:36 +0100x86/mm/numa: Fix 32-bit kernel NUMA boot
When booting a 32-bit x86 kernel on a NUMA machine, node data cannot be allocated from local node if the account of memory for node 0 covers the low memory space entirely:
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x83fffffff] [ 0.000000] NODE_DATA [mem 0x367ed000-0x367edfff] [ 0.000000] Initmem setup node 1 [mem 0x840000000-0xfffffffff] [ 0.000000] Cannot find 4096 bytes in node 1 [ 0.000000] 64664MB HIGHMEM available. [ 0.000000] 871MB LOWMEM available.To fix this issue, node data is allowed to be allocated from other nodes if the memory of local node is still not mapped. The expected result looks like this:
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x83fffffff] [ 0.000000] NODE_DATA [mem 0x367ed000-0x367edfff] [ 0.000000] Initmem setup node 1 [mem 0x840000000-0xfffffffff] [ 0.000000] NODE_DATA [mem 0x367ec000-0x367ecfff] [ 0.000000] NODE_DATA(1) on node 0 [ 0.000000] 64664MB HIGHMEM available. [ 0.000000] 871MB LOWMEM available.Signed-off-by Lans Zhang<[email protected]>Cc <[email protected]>Cc Yinghai Lu<[email protected]>Signed-off-by Ingo Molnar<[email protected]>--- arch/x86/mm/numa.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)arch/x86/mm/numa.c +4
-3@@ -211,9 +211,13 @@ static void __init setup_node_data(int nid, u64 start, u64 end)*/ nd_pa =memblock_alloc_nid (nd_size,SMP_CACHE_BYTES , nid);if (!nd_pa) { -pr_err ("Cannot find %zu bytes in node %d\n" , - nd_size, nid); -return ; + nd_pa =__memblock_alloc_base (nd_size,SMP_CACHE_BYTES , +MEMBLOCK_ALLOC_ACCESSIBLE ); +if (!nd_pa) { + pr_err("Cannot find %zu bytes in node %d\n",
Quoted 8 lines
arch/x86/mm/numa.c static void __init setup_node_data(int nid, u64 start, u64 end) · line 223
Quoted 6 lines
arch/x86/mm/numa.c +3
-0+ nd_size, nid); +return ; + } } nd =__va (nd_pa);Can you just use
memblock_alloc_try_nidinsteadmemblock_alloc_nid?
But memblock_alloc_base() inside memblock_alloc_try_nid() may cause kernel panic if __memblock_alloc_base() inside it fails. In current stage, it is allowed if node data fails to be allocated.
Thanks,
lz
Quoted 5 lines
Thanks
Yinghai
Re: [tip:x86/mm] x86/mm/numa: Fix 32-bit kernel NUMA boot
Quoted 74 lines · Lans Zhang
Quoted 63 lines · Yinghai Lu
Quoted 60 lines · tip-bot for Lans Zhang
Commit-ID:
f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4Gitweb:
http://git.kernel.org/tip/f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4Author: Lans Zhang<[email protected]> AuthorDate: Fri, 6 Dec 2013 12:18:30 +0800 Committer: Ingo Molnar<[email protected]> CommitDate: Thu, 19 Dec 2013 13:58:36 +0100x86/mm/numa: Fix 32-bit kernel NUMA boot
When booting a 32-bit x86 kernel on a NUMA machine, node data cannot be allocated from local node if the account of memory for node 0 covers the low memory space entirely:
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x83fffffff] [ 0.000000] NODE_DATA [mem 0x367ed000-0x367edfff] [ 0.000000] Initmem setup node 1 [mem 0x840000000-0xfffffffff] [ 0.000000] Cannot find 4096 bytes in node 1 [ 0.000000] 64664MB HIGHMEM available. [ 0.000000] 871MB LOWMEM available.To fix this issue, node data is allowed to be allocated from other nodes if the memory of local node is still not mapped. The expected result looks like this:
[ 0.000000] Initmem setup node 0 [mem 0x00000000-0x83fffffff] [ 0.000000] NODE_DATA [mem 0x367ed000-0x367edfff] [ 0.000000] Initmem setup node 1 [mem 0x840000000-0xfffffffff] [ 0.000000] NODE_DATA [mem 0x367ec000-0x367ecfff] [ 0.000000] NODE_DATA(1) on node 0 [ 0.000000] 64664MB HIGHMEM available. [ 0.000000] 871MB LOWMEM available.Link:
http://lkml.kernel.org/r/[email protected]Signed-off-by Ingo Molnar<[email protected]>--- arch/x86/mm/numa.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)arch/x86/mm/numa.c +4
-3@@ -211,9 +211,13 @@ static void __init setup_node_data(int nid, u64start, u64 end) */ nd_pa =memblock_alloc_nid (nd_size,SMP_CACHE_BYTES , nid);if (!nd_pa) { -pr_err ("Cannot find %zu bytes in node %d\n" , - nd_size, nid); -return ; + nd_pa =__memblock_alloc_base (nd_size,SMP_CACHE_BYTES , +MEMBLOCK_ALLOC_ACCESSIBLE ); +if (!nd_pa) { + pr_err("Cannot find %zu bytes in node %d\n",Quoted 8 lines
arch/x86/mm/numa.c static void __init setup_node_data(int nid, u64 start, u64 end) · line 222
Quoted 6 lines
arch/x86/mm/numa.c +3
-0+ nd_size, nid); +return ; + } } nd =__va (nd_pa);Can you just use
memblock_alloc_try_nidinsteadmemblock_alloc_nid?
Quoted 6 lines
But
memblock_alloc_base()insidememblock_alloc_try_nid()may cause kernel panic
if__memblock_alloc_base()inside it fails. In current stage, it is allowed if
node data fails to be allocated.
that take MEMBLOCK_ALLOC_ACCESSIBLE, and it should not happen.
BTW it happens wrongly, should panic. as it can not alloc any.
Thanks
Yinghai