diff options
author | Dave Hansen <haveblue@us.ibm.com> | 2005-06-23 03:07:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-23 12:45:00 -0400 |
commit | c2ebaa425e6630adcbf757b004d257dd4204925b (patch) | |
tree | 9314642388bbe86020e58932cf6bb46be88deb4e /arch/i386/mm | |
parent | 408fde81c1bff15c875a3618481e93a01dcc79ea (diff) |
[PATCH] sparsemem base: early_pfn_to_nid() (works before sparse is initialized)
The following four patches provide the last needed changes before the
introduction of sparsemem. For a more complete description of what this
will do, please see this patch:
http://www.sr71.net/patches/2.6.11/2.6.11-bk7-mhp1/broken-out/B-sparse-150-sparsemem.patch
or previous posts on the subject:
http://marc.theaimsgroup.com/?t=110868540700001&r=1&w=2
http://marc.theaimsgroup.com/?l=linux-mm&m=109897373315016&w=2
Three of these are i386-only, but one of them reorganizes the macros
used to manage the space in page->flags, and will affect all platforms.
There are analogous patches to the i386 ones for ppc64, ia64, and
x86_64, but those will be submitted by the normal arch maintainers.
The combination of the four patches has been test-booted on a variety of
i386 hardware, and compiled for ppc64, i386, and x86-64 with about 17
different .configs. It's also been runtime-tested on ia64 configs (with
more patches on top).
This patch:
We _know_ which node pages in general belong to, at least at a very gross
level in node_{start,end}_pfn[]. Use those to target the allocations of
pages.
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/mm')
-rw-r--r-- | arch/i386/mm/discontig.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c index 1726b4096b10..85d2fcbe1079 100644 --- a/arch/i386/mm/discontig.c +++ b/arch/i386/mm/discontig.c | |||
@@ -146,6 +146,21 @@ static void __init find_max_pfn_node(int nid) | |||
146 | BUG(); | 146 | BUG(); |
147 | } | 147 | } |
148 | 148 | ||
149 | /* Find the owning node for a pfn. */ | ||
150 | int early_pfn_to_nid(unsigned long pfn) | ||
151 | { | ||
152 | int nid; | ||
153 | |||
154 | for_each_node(nid) { | ||
155 | if (node_end_pfn[nid] == 0) | ||
156 | break; | ||
157 | if (node_start_pfn[nid] <= pfn && node_end_pfn[nid] >= pfn) | ||
158 | return nid; | ||
159 | } | ||
160 | |||
161 | return 0; | ||
162 | } | ||
163 | |||
149 | /* | 164 | /* |
150 | * Allocate memory for the pg_data_t for this node via a crude pre-bootmem | 165 | * Allocate memory for the pg_data_t for this node via a crude pre-bootmem |
151 | * method. For node zero take this from the bottom of memory, for | 166 | * method. For node zero take this from the bottom of memory, for |