Commit 14694d73 authored by David Rientjes's avatar David Rientjes Committed by Andi Kleen

[PATCH] x86-64: split remaining fake nodes equally

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: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Cc: Paul Jackson <pj@sgi.com>
Cc: Christoph Lameter <clameter@engr.sgi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 8b8ca80e
...@@ -155,7 +155,9 @@ NUMA ...@@ -155,7 +155,9 @@ NUMA
depending on the sizes and coefficients listed. For example: depending on the sizes and coefficients listed. For example:
numa=fake=2*512,1024,4*256 numa=fake=2*512,1024,4*256
gives two 512M nodes, a 1024M node, and four 256M nodes. The 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 numa=hotadd=percent
Only allow hotadd memory to preallocate page structures upto Only allow hotadd memory to preallocate page structures upto
......
...@@ -418,11 +418,25 @@ static int __init numa_emulation(unsigned long start_pfn, unsigned long end_pfn) ...@@ -418,11 +418,25 @@ static int __init numa_emulation(unsigned long start_pfn, unsigned long end_pfn)
done: done:
if (!num_nodes) if (!num_nodes)
return -1; return -1;
/* Fill remainder of system RAM with a final node, if appropriate. */ /* Fill remainder of system RAM, if appropriate. */
if (addr < max_addr) { if (addr < max_addr) {
setup_node_range(num_nodes, nodes, &addr, max_addr - addr, switch (*(cmdline - 1)) {
max_addr); case '*':
num_nodes++; /* 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: out:
memnode_shift = compute_hash_shift(nodes, num_nodes); memnode_shift = compute_hash_shift(nodes, num_nodes);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment