public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mm/numa: fix becoming single node on numa machine with 32-bit kernel.
@ 2013-12-06  4:18 Lans Zhang
  2013-12-06 18:22 ` Andi Kleen
  2013-12-19 15:42 ` [tip:x86/mm] x86/mm/numa: Fix 32-bit kernel NUMA boot tip-bot for Lans Zhang
  0 siblings, 2 replies; 6+ messages in thread
From: Lans Zhang @ 2013-12-06  4:18 UTC (permalink / raw)
  To: andi, mingo; +Cc: linux-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.

Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
---
 arch/x86/mm/numa.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 24aec58..c85da7b 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -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);
 
-- 
1.7.8.110.g4cb5d


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86/mm/numa: fix becoming single node on numa machine with 32-bit kernel.
  2013-12-06  4:18 [PATCH] x86/mm/numa: fix becoming single node on numa machine with 32-bit kernel Lans Zhang
@ 2013-12-06 18:22 ` Andi Kleen
  2013-12-19 15:42 ` [tip:x86/mm] x86/mm/numa: Fix 32-bit kernel NUMA boot tip-bot for Lans Zhang
  1 sibling, 0 replies; 6+ messages in thread
From: Andi Kleen @ 2013-12-06 18:22 UTC (permalink / raw)
  To: Lans Zhang; +Cc: mingo, linux-kernel

Lans Zhang <jia.zhang@windriver.com> writes:
>
> Signed-off-by: Lans Zhang <jia.zhang@windriver.com>

Patch looks good to me.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip:x86/mm] x86/mm/numa: Fix 32-bit kernel NUMA boot
  2013-12-06  4:18 [PATCH] x86/mm/numa: fix becoming single node on numa machine with 32-bit kernel Lans Zhang
  2013-12-06 18:22 ` Andi Kleen
@ 2013-12-19 15:42 ` tip-bot for Lans Zhang
  2013-12-19 16:44   ` Yinghai Lu
  1 sibling, 1 reply; 6+ messages in thread
From: tip-bot for Lans Zhang @ 2013-12-19 15:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, andi, jia.zhang, tglx

Commit-ID:  f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4
Gitweb:     http://git.kernel.org/tip/f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4
Author:     Lans Zhang <jia.zhang@windriver.com>
AuthorDate: Fri, 6 Dec 2013 12:18:30 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
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.

Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
Cc: <andi@firstfloor.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1386303510-18574-1-git-send-email-jia.zhang@windriver.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/mm/numa.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 24aec58..c85da7b 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -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);
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [tip:x86/mm] x86/mm/numa: Fix 32-bit kernel NUMA boot
  2013-12-19 15:42 ` [tip:x86/mm] x86/mm/numa: Fix 32-bit kernel NUMA boot tip-bot for Lans Zhang
@ 2013-12-19 16:44   ` Yinghai Lu
  2013-12-20  2:17     ` Lans Zhang
  0 siblings, 1 reply; 6+ messages in thread
From: Yinghai Lu @ 2013-12-19 16:44 UTC (permalink / raw)
  To: Ingo Molnar, H. Peter Anvin, Linux Kernel Mailing List,
	Andi Kleen, Yinghai Lu, jia.zhang, Thomas Gleixner
  Cc: linux-tip-commits@vger.kernel.org

On Thu, Dec 19, 2013 at 7:42 AM, tip-bot for Lans Zhang
<tipbot@zytor.com> wrote:
> Commit-ID:  f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4
> Gitweb:     http://git.kernel.org/tip/f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4
> Author:     Lans Zhang <jia.zhang@windriver.com>
> AuthorDate: Fri, 6 Dec 2013 12:18:30 +0800
> Committer:  Ingo Molnar <mingo@kernel.org>
> 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.
>
> Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
> Cc: <andi@firstfloor.org>
> Cc: Yinghai Lu <yinghai@kernel.org>
> Link: http://lkml.kernel.org/r/1386303510-18574-1-git-send-email-jia.zhang@windriver.com
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> ---
>  arch/x86/mm/numa.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
> index 24aec58..c85da7b 100644
> --- a/arch/x86/mm/numa.c
> +++ b/arch/x86/mm/numa.c
> @@ -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);
>

Can you just use memblock_alloc_try_nid instead memblock_alloc_nid?

Thanks

Yinghai

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tip:x86/mm] x86/mm/numa: Fix 32-bit kernel NUMA boot
  2013-12-19 16:44   ` Yinghai Lu
@ 2013-12-20  2:17     ` Lans Zhang
  2013-12-20  6:23       ` Yinghai Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Lans Zhang @ 2013-12-20  2:17 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, H. Peter Anvin, Linux Kernel Mailing List,
	Andi Kleen, Thomas Gleixner, linux-tip-commits@vger.kernel.org

On 12/20/2013 12:44 AM, Yinghai Lu wrote:
> On Thu, Dec 19, 2013 at 7:42 AM, tip-bot for Lans Zhang
> <tipbot@zytor.com>  wrote:
>> Commit-ID:  f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4
>> Gitweb:     http://git.kernel.org/tip/f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4
>> Author:     Lans Zhang<jia.zhang@windriver.com>
>> AuthorDate: Fri, 6 Dec 2013 12:18:30 +0800
>> Committer:  Ingo Molnar<mingo@kernel.org>
>> 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.
>>
>> Signed-off-by: Lans Zhang<jia.zhang@windriver.com>
>> Cc:<andi@firstfloor.org>
>> Cc: Yinghai Lu<yinghai@kernel.org>
>> Link: http://lkml.kernel.org/r/1386303510-18574-1-git-send-email-jia.zhang@windriver.com
>> Signed-off-by: Ingo Molnar<mingo@kernel.org>
>> ---
>>   arch/x86/mm/numa.c | 10 +++++++---
>>   1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
>> index 24aec58..c85da7b 100644
>> --- a/arch/x86/mm/numa.c
>> +++ b/arch/x86/mm/numa.c
>> @@ -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);
>>
>
> Can you just use memblock_alloc_try_nid instead memblock_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

>
> Thanks
>
> Yinghai
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tip:x86/mm] x86/mm/numa: Fix 32-bit kernel NUMA boot
  2013-12-20  2:17     ` Lans Zhang
@ 2013-12-20  6:23       ` Yinghai Lu
  0 siblings, 0 replies; 6+ messages in thread
From: Yinghai Lu @ 2013-12-20  6:23 UTC (permalink / raw)
  To: Lans Zhang
  Cc: Ingo Molnar, H. Peter Anvin, Linux Kernel Mailing List,
	Andi Kleen, Thomas Gleixner, linux-tip-commits@vger.kernel.org

On Thu, Dec 19, 2013 at 6:17 PM, Lans Zhang <jia.zhang@windriver.com> wrote:
> On 12/20/2013 12:44 AM, Yinghai Lu wrote:
>>
>> On Thu, Dec 19, 2013 at 7:42 AM, tip-bot for Lans Zhang
>> <tipbot@zytor.com>  wrote:
>>>
>>> Commit-ID:  f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4
>>> Gitweb:
>>> http://git.kernel.org/tip/f3d815cb854b2f6262ade56a4d91a1ed3f1e50c4
>>> Author:     Lans Zhang<jia.zhang@windriver.com>
>>> AuthorDate: Fri, 6 Dec 2013 12:18:30 +0800
>>> Committer:  Ingo Molnar<mingo@kernel.org>
>>> 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.
>>>
>>> Signed-off-by: Lans Zhang<jia.zhang@windriver.com>
>>> Cc:<andi@firstfloor.org>
>>> Cc: Yinghai Lu<yinghai@kernel.org>
>>> Link:
>>> http://lkml.kernel.org/r/1386303510-18574-1-git-send-email-jia.zhang@windriver.com
>>> Signed-off-by: Ingo Molnar<mingo@kernel.org>
>>> ---
>>>   arch/x86/mm/numa.c | 10 +++++++---
>>>   1 file changed, 7 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
>>> index 24aec58..c85da7b 100644
>>> --- a/arch/x86/mm/numa.c
>>> +++ b/arch/x86/mm/numa.c
>>> @@ -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);
>>>
>>
>> Can you just use memblock_alloc_try_nid instead memblock_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.
>

that take MEMBLOCK_ALLOC_ACCESSIBLE, and it should not happen.

BTW it happens wrongly, should panic. as it can not alloc any.

Thanks

Yinghai

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-12-20  6:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-06  4:18 [PATCH] x86/mm/numa: fix becoming single node on numa machine with 32-bit kernel Lans Zhang
2013-12-06 18:22 ` Andi Kleen
2013-12-19 15:42 ` [tip:x86/mm] x86/mm/numa: Fix 32-bit kernel NUMA boot tip-bot for Lans Zhang
2013-12-19 16:44   ` Yinghai Lu
2013-12-20  2:17     ` Lans Zhang
2013-12-20  6:23       ` Yinghai Lu

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