aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memblock.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-07-14 05:43:42 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2011-07-14 14:47:43 -0400
commit7c0caeb866b0f648d91bb75b8bc6f86af95bb033 (patch)
tree042804fe716310a4de4effbbaa4461237e2b5d4a /include/linux/memblock.h
parent67e24bcb725cabd15ef577bf301275d03d6086d7 (diff)
memblock: Add optional region->nid
From 83103b92f3234ec830852bbc5c45911bd6cbdb20 Mon Sep 17 00:00:00 2001 From: Tejun Heo <tj@kernel.org> Date: Thu, 14 Jul 2011 11:22:16 +0200 Add optional region->nid which can be enabled by arch using CONFIG_HAVE_MEMBLOCK_NODE_MAP. When enabled, memblock also carries NUMA node information and replaces early_node_map[]. Newly added memblocks have MAX_NUMNODES as nid. Arch can then call memblock_set_node() to set node information. memblock takes care of merging and node affine allocations w.r.t. node information. When MEMBLOCK_NODE_MAP is enabled, early_node_map[], related data structures and functions to manipulate and iterate it are disabled. memblock version of __next_mem_pfn_range() is provided such that for_each_mem_pfn_range() behaves the same and its users don't have to be updated. -v2: Yinghai spotted section mismatch caused by missing __init_memblock in memblock_set_node(). Fixed. Signed-off-by: Tejun Heo <tj@kernel.org> Link: http://lkml.kernel.org/r/20110714094342.GF3455@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/memblock.h')
-rw-r--r--include/linux/memblock.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 434b958a4f5f..c36a55d3c1c2 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -24,6 +24,9 @@
24struct memblock_region { 24struct memblock_region {
25 phys_addr_t base; 25 phys_addr_t base;
26 phys_addr_t size; 26 phys_addr_t size;
27#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
28 int nid;
29#endif
27}; 30};
28 31
29struct memblock_type { 32struct memblock_type {
@@ -58,6 +61,29 @@ extern long memblock_remove(phys_addr_t base, phys_addr_t size);
58extern long memblock_free(phys_addr_t base, phys_addr_t size); 61extern long memblock_free(phys_addr_t base, phys_addr_t size);
59extern long memblock_reserve(phys_addr_t base, phys_addr_t size); 62extern long memblock_reserve(phys_addr_t base, phys_addr_t size);
60 63
64#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
65extern int memblock_set_node(phys_addr_t base, phys_addr_t size, int nid);
66
67static inline void memblock_set_region_node(struct memblock_region *r, int nid)
68{
69 r->nid = nid;
70}
71
72static inline int memblock_get_region_node(const struct memblock_region *r)
73{
74 return r->nid;
75}
76#else
77static inline void memblock_set_region_node(struct memblock_region *r, int nid)
78{
79}
80
81static inline int memblock_get_region_node(const struct memblock_region *r)
82{
83 return 0;
84}
85#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
86
61/* The numa aware allocator is only available if 87/* The numa aware allocator is only available if
62 * CONFIG_ARCH_POPULATES_NODE_MAP is set 88 * CONFIG_ARCH_POPULATES_NODE_MAP is set
63 */ 89 */