LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Andi Kleen <ak@suse.de>, Rohit Seth <rohitseth@google.com>,
	linux-kernel@vger.kernel.org
Subject: [patch -mm 2/7] x86_64: split remaining fake nodes equally
Date: Wed, 31 Jan 2007 07:17:59 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0701302224300.23658@chino.kir.corp.google.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0701302223230.23653@chino.kir.corp.google.com>

Extends the numa=fake x86_64 command-line option to split the remaining
system memory into equal-sized nodes.

For example:
numa=fake=2*512,4*	gives two 512M nodes and the remaining system
			memory is split into four approximately equal
			chunks.

This is beneficial for systems where the exact size of RAM is unknown or
not necessarily relevant, but the granularity with which nodes shall be
allocated is known.

Cc: Andi Kleen <ak@suse.de>
Signed-off-by: David Rientjes <rientjes@google.com>
---
 Documentation/x86_64/boot-options.txt |    4 +++-
 arch/x86_64/mm/numa.c                 |   22 ++++++++++++++++++----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt
index 87f4279..01dfec9 100644
--- a/Documentation/x86_64/boot-options.txt
+++ b/Documentation/x86_64/boot-options.txt
@@ -155,7 +155,9 @@ NUMA
 		depending on the sizes and coefficients listed.  For example:
 			numa=fake=2*512,1024,4*256
 		gives two 512M nodes, a 1024M node, and four 256M nodes.  The
-		remaining system RAM is allocated to an additional node.
+		remaining system RAM is allocated to an additional node.  If
+		the last character of CMDLINE is a *, the remaining system RAM
+		is instead divided up equally among its coefficient.
 
   numa=hotadd=percent
 		Only allow hotadd memory to preallocate page structures upto
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index a5bda07..6c4b45f 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -421,11 +421,25 @@ static int __init numa_emulation(unsigned long start_pfn, unsigned long end_pfn)
 done:
 	if (!num_nodes)
 		return -1;
-	/* Fill remainder of system RAM with a final node, if appropriate. */
+	/* Fill remainder of system RAM, if appropriate. */
 	if (addr < max_addr) {
-		setup_node_range(num_nodes, nodes, &addr, max_addr - addr,
-				 max_addr);
-		num_nodes++;
+		switch (*(cmdline - 1)) {
+		case '*':
+			/* Split remaining nodes into coeff chunks */
+			if (coeff <= 0)
+				break;
+			num_nodes += split_nodes_equally(nodes, &addr, max_addr,
+							 num_nodes, coeff);
+			break;
+		case ',':
+			/* Do not allocate remaining system RAM */
+			break;
+		default:
+			/* Give one final node */
+			setup_node_range(num_nodes, nodes, &addr,
+					 max_addr - addr, max_addr);
+			num_nodes++;
+		}
 	}
 out:
 	memnode_shift = compute_hash_shift(nodes, num_nodes);

  reply	other threads:[~2007-01-31 15:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-31 15:17 [patch -mm 1/7] x86_64: configurable fake numa node sizes David Rientjes
2007-01-31 15:17 ` David Rientjes [this message]
2007-01-31 15:18   ` [patch -mm 3/7] x86_64: fixed-size remaining fake nodes David Rientjes
2007-01-31 15:18     ` [patch -mm 4/7] x86_64: fake numa for cpusets document David Rientjes
2007-01-31 15:18       ` [patch -mm 5/7] x86_64: map fake nodes to real nodes David Rientjes
2007-01-31 15:18         ` [patch -mm 6/7] x86_64: disable alien cache for fake numa David Rientjes
2007-01-31 15:18           ` [patch -mm 7/7] x86_64: export physnode mapping to userspace David Rientjes
2007-03-01 17:12 [patch -mm 1/7] x86_64: configurable fake numa node sizes David Rientjes
2007-03-01 17:13 ` [patch -mm 2/7] x86_64: split remaining fake nodes equally David Rientjes

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=Pine.LNX.4.64.0701302224300.23658@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rohitseth@google.com \
    --subject='Re: [patch -mm 2/7] x86_64: split remaining fake nodes equally' \
    /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

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 NNTP newsgroup(s).