diff options
author | Mel Gorman <mel@skynet.ie> | 2006-09-27 10:49:58 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-27 17:26:11 +0200 |
commit | 9c7cd6877cf8db15269163deda69392263124c1e (patch) | |
tree | ff5197bdd2d5f02a5032c050eb39349534a4b14b /mm/page_alloc.c | |
parent | [PATCH] Account for memmap and optionally the kernel image as holes (diff) | |
download | linux-9c7cd6877cf8db15269163deda69392263124c1e.tar.xz linux-9c7cd6877cf8db15269163deda69392263124c1e.zip |
[PATCH] Account for holes that are outside the range of physical memory
absent_pages_in_range() made the assumption that users of the API would not
care about holes beyound the end of physical memory. This was not the
case. This patch will account for ranges outside of physical memory as
holes correctly.
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Andy Whitcroft <apw@shadowen.org>
Cc: Andi Kleen <ak@muc.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: "Keith Mannthey" <kmannth@gmail.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8d9a1eb9fbba..75133e1dc4b1 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2168,6 +2168,10 @@ unsigned long __init __absent_pages_in_range(int nid, if (i == -1) return 0; + /* Account for ranges before physical memory on this node */ + if (early_node_map[i].start_pfn > range_start_pfn) + hole_pages = early_node_map[i].start_pfn - range_start_pfn; + prev_end_pfn = early_node_map[i].start_pfn; /* Find all holes for the zone within the node */ @@ -2189,6 +2193,11 @@ unsigned long __init __absent_pages_in_range(int nid, prev_end_pfn = early_node_map[i].end_pfn; } + /* Account for ranges past physical memory on this node */ + if (range_end_pfn > prev_end_pfn) + hole_pages = range_end_pfn - + max(range_start_pfn, prev_end_pfn); + return hole_pages; } @@ -2210,9 +2219,16 @@ unsigned long __init zone_absent_pages_in_node(int nid, unsigned long zone_type, unsigned long *ignored) { - return __absent_pages_in_range(nid, - arch_zone_lowest_possible_pfn[zone_type], - arch_zone_highest_possible_pfn[zone_type]); + unsigned long node_start_pfn, node_end_pfn; + unsigned long zone_start_pfn, zone_end_pfn; + + get_pfn_range_for_nid(nid, &node_start_pfn, &node_end_pfn); + zone_start_pfn = max(arch_zone_lowest_possible_pfn[zone_type], + node_start_pfn); + zone_end_pfn = min(arch_zone_highest_possible_pfn[zone_type], + node_end_pfn); + + return __absent_pages_in_range(nid, zone_start_pfn, zone_end_pfn); } /* Return the zone index a PFN is in */ |