diff options
author | Tejun Heo <tj@kernel.org> | 2011-07-14 03:46:10 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2011-07-14 14:45:29 -0400 |
commit | 5dfe8660a3d7f1ee1265c3536433ee53da3f98a3 (patch) | |
tree | c58232b88741ba1d8cce417b62f3f658369ad9c2 /include/linux/mm.h | |
parent | fc769a8e70a3348d5de49e5f69f6aff810157360 (diff) |
bootmem: Replace work_with_active_regions() with for_each_mem_pfn_range()
Callback based iteration is cumbersome and much less useful than
for_each_*() iterator. This patch implements for_each_mem_pfn_range()
which replaces work_with_active_regions(). All the current users of
work_with_active_regions() are converted.
This simplifies walking over early_node_map and will allow converting
internal logics in page_alloc to use iterator instead of walking
early_node_map directly, which in turn will enable moving node
information to memblock.
powerpc change is only compile tested.
Signed-off-by: Tejun Heo <tj@kernel.org>
Link: http://lkml.kernel.org/r/20110714074610.GD3455@htj.dyndns.org
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r-- | include/linux/mm.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index c70a326b8f26..57e4c9ffdff8 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1327,9 +1327,27 @@ int add_from_early_node_map(struct range *range, int az, | |||
1327 | int nr_range, int nid); | 1327 | int nr_range, int nid); |
1328 | u64 __init find_memory_core_early(int nid, u64 size, u64 align, | 1328 | u64 __init find_memory_core_early(int nid, u64 size, u64 align, |
1329 | u64 goal, u64 limit); | 1329 | u64 goal, u64 limit); |
1330 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); | ||
1331 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); | ||
1332 | extern void sparse_memory_present_with_active_regions(int nid); | 1330 | extern void sparse_memory_present_with_active_regions(int nid); |
1331 | |||
1332 | extern void __next_mem_pfn_range(int *idx, int nid, | ||
1333 | unsigned long *out_start_pfn, | ||
1334 | unsigned long *out_end_pfn, int *out_nid); | ||
1335 | |||
1336 | /** | ||
1337 | * for_each_mem_pfn_range - early memory pfn range iterator | ||
1338 | * @i: an integer used as loop variable | ||
1339 | * @nid: node selector, %MAX_NUMNODES for all nodes | ||
1340 | * @p_start: ptr to ulong for start pfn of the range, can be %NULL | ||
1341 | * @p_end: ptr to ulong for end pfn of the range, can be %NULL | ||
1342 | * @p_nid: ptr to int for nid of the range, can be %NULL | ||
1343 | * | ||
1344 | * Walks over configured memory ranges. Available after early_node_map is | ||
1345 | * populated. | ||
1346 | */ | ||
1347 | #define for_each_mem_pfn_range(i, nid, p_start, p_end, p_nid) \ | ||
1348 | for (i = -1, __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid); \ | ||
1349 | i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid)) | ||
1350 | |||
1333 | #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ | 1351 | #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */ |
1334 | 1352 | ||
1335 | #if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \ | 1353 | #if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \ |