linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lans Zhang <jia.zhang@windriver.com>
To: andi@firstfloor.org, mingo@kernel.org
Cc: linux-x86_64@vger.kernel.org, linux-numa@vger.kernel.org
Subject: [PATCH] x86/mm/numa: fix becoming single node on numa machine with 32-bit kernel.
Date: Wed, 4 Dec 2013 11:51:05 +0800	[thread overview]
Message-ID: <1386129065-17970-1-git-send-email-jia.zhang@windriver.com> (raw)

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

                 reply	other threads:[~2013-12-04  3:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386129065-17970-1-git-send-email-jia.zhang@windriver.com \
    --to=jia.zhang@windriver.com \
    --cc=andi@firstfloor.org \
    --cc=linux-numa@vger.kernel.org \
    --cc=linux-x86_64@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).