aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mmzone.h
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@shadowen.org>2007-05-06 17:49:14 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:12:52 -0400
commit14e072984179d3d421bf9ab75cc67e0961742841 (patch)
tree65a5a6f7d9756b8e7010278b58908d04da257a28 /include/linux/mmzone.h
parentac267728f13c55017ed5ee243c9c3166e27ab929 (diff)
add pfn_valid_within helper for sub-MAX_ORDER hole detection
Generally we work under the assumption that memory the mem_map array is contigious and valid out to MAX_ORDER_NR_PAGES block of pages, ie. that if we have validated any page within this MAX_ORDER_NR_PAGES block we need not check any other. This is not true when CONFIG_HOLES_IN_ZONE is set and we must check each and every reference we make from a pfn. Add a pfn_valid_within() helper which should be used when scanning pages within a MAX_ORDER_NR_PAGES block when we have already checked the validility of the block normally with pfn_valid(). This can then be optimised away when we do not have holes within a MAX_ORDER_NR_PAGES block of pages. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Acked-by: Mel Gorman <mel@csn.ul.ie> Acked-by: Bob Picco <bob.picco@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mmzone.h')
-rw-r--r--include/linux/mmzone.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index ee9e3143df4f..2f1544e83042 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -784,6 +784,18 @@ void sparse_init(void);
784void memory_present(int nid, unsigned long start, unsigned long end); 784void memory_present(int nid, unsigned long start, unsigned long end);
785unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long); 785unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
786 786
787/*
788 * If it is possible to have holes within a MAX_ORDER_NR_PAGES, then we
789 * need to check pfn validility within that MAX_ORDER_NR_PAGES block.
790 * pfn_valid_within() should be used in this case; we optimise this away
791 * when we have no holes within a MAX_ORDER_NR_PAGES block.
792 */
793#ifdef CONFIG_HOLES_IN_ZONE
794#define pfn_valid_within(pfn) pfn_valid(pfn)
795#else
796#define pfn_valid_within(pfn) (1)
797#endif
798
787#endif /* !__ASSEMBLY__ */ 799#endif /* !__ASSEMBLY__ */
788#endif /* __KERNEL__ */ 800#endif /* __KERNEL__ */
789#endif /* _LINUX_MMZONE_H */ 801#endif /* _LINUX_MMZONE_H */