diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2011-06-16 04:28:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-06-27 17:13:09 -0400 |
commit | c6830c22603aaecf65405af23f6da2d55892f9cb (patch) | |
tree | 19458ebc7c32bef8a4ed59630cabb5785b1bdc11 | |
parent | af4087e0e682df12bdffec5cfafc2fec9208716e (diff) |
Fix node_start/end_pfn() definition for mm/page_cgroup.c
commit 21a3c96 uses node_start/end_pfn(nid) for detection start/end
of nodes. But, it's not defined in linux/mmzone.h but defined in
/arch/???/include/mmzone.h which is included only under
CONFIG_NEED_MULTIPLE_NODES=y.
Then, we see
mm/page_cgroup.c: In function 'page_cgroup_init':
mm/page_cgroup.c:308: error: implicit declaration of function 'node_start_pfn'
mm/page_cgroup.c:309: error: implicit declaration of function 'node_end_pfn'
So, fixiing page_cgroup.c is an idea...
But node_start_pfn()/node_end_pfn() is a very generic macro and
should be implemented in the same manner for all archs.
(m32r has different implementation...)
This patch removes definitions of node_start/end_pfn() in each archs
and defines a unified one in linux/mmzone.h. It's not under
CONFIG_NEED_MULTIPLE_NODES, now.
A result of macro expansion is here (mm/page_cgroup.c)
for !NUMA
start_pfn = ((&contig_page_data)->node_start_pfn);
end_pfn = ({ pg_data_t *__pgdat = (&contig_page_data); __pgdat->node_start_pfn + __pgdat->node_spanned_pages;});
for NUMA (x86-64)
start_pfn = ((node_data[nid])->node_start_pfn);
end_pfn = ({ pg_data_t *__pgdat = (node_data[nid]); __pgdat->node_start_pfn + __pgdat->node_spanned_pages;});
Changelog:
- fixed to avoid using "nid" twice in node_end_pfn() macro.
Reported-and-acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Reported-and-tested-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/alpha/include/asm/mmzone.h | 1 | ||||
-rw-r--r-- | arch/m32r/include/asm/mmzone.h | 8 | ||||
-rw-r--r-- | arch/parisc/include/asm/mmzone.h | 7 | ||||
-rw-r--r-- | arch/powerpc/include/asm/mmzone.h | 7 | ||||
-rw-r--r-- | arch/sh/include/asm/mmzone.h | 4 | ||||
-rw-r--r-- | arch/sparc/include/asm/mmzone.h | 2 | ||||
-rw-r--r-- | arch/tile/include/asm/mmzone.h | 11 | ||||
-rw-r--r-- | arch/x86/include/asm/mmzone_32.h | 11 | ||||
-rw-r--r-- | arch/x86/include/asm/mmzone_64.h | 3 | ||||
-rw-r--r-- | include/linux/mmzone.h | 7 |
10 files changed, 8 insertions, 53 deletions
diff --git a/arch/alpha/include/asm/mmzone.h b/arch/alpha/include/asm/mmzone.h index 8af56ce346ad..445dc42e0334 100644 --- a/arch/alpha/include/asm/mmzone.h +++ b/arch/alpha/include/asm/mmzone.h | |||
@@ -56,7 +56,6 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) | |||
56 | * Given a kernel address, find the home node of the underlying memory. | 56 | * Given a kernel address, find the home node of the underlying memory. |
57 | */ | 57 | */ |
58 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) | 58 | #define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) |
59 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | ||
60 | 59 | ||
61 | /* | 60 | /* |
62 | * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory | 61 | * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory |
diff --git a/arch/m32r/include/asm/mmzone.h b/arch/m32r/include/asm/mmzone.h index 9f3b5accda88..115ced33febd 100644 --- a/arch/m32r/include/asm/mmzone.h +++ b/arch/m32r/include/asm/mmzone.h | |||
@@ -14,12 +14,6 @@ extern struct pglist_data *node_data[]; | |||
14 | #define NODE_DATA(nid) (node_data[nid]) | 14 | #define NODE_DATA(nid) (node_data[nid]) |
15 | 15 | ||
16 | #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) | 16 | #define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) |
17 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | ||
18 | #define node_end_pfn(nid) \ | ||
19 | ({ \ | ||
20 | pg_data_t *__pgdat = NODE_DATA(nid); \ | ||
21 | __pgdat->node_start_pfn + __pgdat->node_spanned_pages - 1; \ | ||
22 | }) | ||
23 | 17 | ||
24 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) | 18 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) |
25 | /* | 19 | /* |
@@ -44,7 +38,7 @@ static __inline__ int pfn_to_nid(unsigned long pfn) | |||
44 | int node; | 38 | int node; |
45 | 39 | ||
46 | for (node = 0 ; node < MAX_NUMNODES ; node++) | 40 | for (node = 0 ; node < MAX_NUMNODES ; node++) |
47 | if (pfn >= node_start_pfn(node) && pfn <= node_end_pfn(node)) | 41 | if (pfn >= node_start_pfn(node) && pfn < node_end_pfn(node)) |
48 | break; | 42 | break; |
49 | 43 | ||
50 | return node; | 44 | return node; |
diff --git a/arch/parisc/include/asm/mmzone.h b/arch/parisc/include/asm/mmzone.h index 9608d2cf214a..e67eb9c3d1bf 100644 --- a/arch/parisc/include/asm/mmzone.h +++ b/arch/parisc/include/asm/mmzone.h | |||
@@ -14,13 +14,6 @@ extern struct node_map_data node_data[]; | |||
14 | 14 | ||
15 | #define NODE_DATA(nid) (&node_data[nid].pg_data) | 15 | #define NODE_DATA(nid) (&node_data[nid].pg_data) |
16 | 16 | ||
17 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | ||
18 | #define node_end_pfn(nid) \ | ||
19 | ({ \ | ||
20 | pg_data_t *__pgdat = NODE_DATA(nid); \ | ||
21 | __pgdat->node_start_pfn + __pgdat->node_spanned_pages; \ | ||
22 | }) | ||
23 | |||
24 | /* We have these possible memory map layouts: | 17 | /* We have these possible memory map layouts: |
25 | * Astro: 0-3.75, 67.75-68, 4-64 | 18 | * Astro: 0-3.75, 67.75-68, 4-64 |
26 | * zx1: 0-1, 257-260, 4-256 | 19 | * zx1: 0-1, 257-260, 4-256 |
diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h index fd3fd58bad84..7b589178be46 100644 --- a/arch/powerpc/include/asm/mmzone.h +++ b/arch/powerpc/include/asm/mmzone.h | |||
@@ -38,13 +38,6 @@ u64 memory_hotplug_max(void); | |||
38 | #define memory_hotplug_max() memblock_end_of_DRAM() | 38 | #define memory_hotplug_max() memblock_end_of_DRAM() |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | /* | ||
42 | * Following are macros that each numa implmentation must define. | ||
43 | */ | ||
44 | |||
45 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | ||
46 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn) | ||
47 | |||
48 | #else | 41 | #else |
49 | #define memory_hotplug_max() memblock_end_of_DRAM() | 42 | #define memory_hotplug_max() memblock_end_of_DRAM() |
50 | #endif /* CONFIG_NEED_MULTIPLE_NODES */ | 43 | #endif /* CONFIG_NEED_MULTIPLE_NODES */ |
diff --git a/arch/sh/include/asm/mmzone.h b/arch/sh/include/asm/mmzone.h index 8887baff5eff..15a8496960e6 100644 --- a/arch/sh/include/asm/mmzone.h +++ b/arch/sh/include/asm/mmzone.h | |||
@@ -9,10 +9,6 @@ | |||
9 | extern struct pglist_data *node_data[]; | 9 | extern struct pglist_data *node_data[]; |
10 | #define NODE_DATA(nid) (node_data[nid]) | 10 | #define NODE_DATA(nid) (node_data[nid]) |
11 | 11 | ||
12 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | ||
13 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ | ||
14 | NODE_DATA(nid)->node_spanned_pages) | ||
15 | |||
16 | static inline int pfn_to_nid(unsigned long pfn) | 12 | static inline int pfn_to_nid(unsigned long pfn) |
17 | { | 13 | { |
18 | int nid; | 14 | int nid; |
diff --git a/arch/sparc/include/asm/mmzone.h b/arch/sparc/include/asm/mmzone.h index e8c648741ed4..99d9b9f577bf 100644 --- a/arch/sparc/include/asm/mmzone.h +++ b/arch/sparc/include/asm/mmzone.h | |||
@@ -8,8 +8,6 @@ | |||
8 | extern struct pglist_data *node_data[]; | 8 | extern struct pglist_data *node_data[]; |
9 | 9 | ||
10 | #define NODE_DATA(nid) (node_data[nid]) | 10 | #define NODE_DATA(nid) (node_data[nid]) |
11 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | ||
12 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_end_pfn) | ||
13 | 11 | ||
14 | extern int numa_cpu_lookup_table[]; | 12 | extern int numa_cpu_lookup_table[]; |
15 | extern cpumask_t numa_cpumask_lookup_table[]; | 13 | extern cpumask_t numa_cpumask_lookup_table[]; |
diff --git a/arch/tile/include/asm/mmzone.h b/arch/tile/include/asm/mmzone.h index c6344c4f32ac..9d3dbce8f953 100644 --- a/arch/tile/include/asm/mmzone.h +++ b/arch/tile/include/asm/mmzone.h | |||
@@ -40,17 +40,6 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
40 | return highbits_to_node[__pfn_to_highbits(pfn)]; | 40 | return highbits_to_node[__pfn_to_highbits(pfn)]; |
41 | } | 41 | } |
42 | 42 | ||
43 | /* | ||
44 | * Following are macros that each numa implmentation must define. | ||
45 | */ | ||
46 | |||
47 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | ||
48 | #define node_end_pfn(nid) \ | ||
49 | ({ \ | ||
50 | pg_data_t *__pgdat = NODE_DATA(nid); \ | ||
51 | __pgdat->node_start_pfn + __pgdat->node_spanned_pages; \ | ||
52 | }) | ||
53 | |||
54 | #define kern_addr_valid(kaddr) virt_addr_valid((void *)kaddr) | 43 | #define kern_addr_valid(kaddr) virt_addr_valid((void *)kaddr) |
55 | 44 | ||
56 | static inline int pfn_valid(int pfn) | 45 | static inline int pfn_valid(int pfn) |
diff --git a/arch/x86/include/asm/mmzone_32.h b/arch/x86/include/asm/mmzone_32.h index 5e83a416eca8..224e8c5eb307 100644 --- a/arch/x86/include/asm/mmzone_32.h +++ b/arch/x86/include/asm/mmzone_32.h | |||
@@ -48,17 +48,6 @@ static inline int pfn_to_nid(unsigned long pfn) | |||
48 | #endif | 48 | #endif |
49 | } | 49 | } |
50 | 50 | ||
51 | /* | ||
52 | * Following are macros that each numa implmentation must define. | ||
53 | */ | ||
54 | |||
55 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | ||
56 | #define node_end_pfn(nid) \ | ||
57 | ({ \ | ||
58 | pg_data_t *__pgdat = NODE_DATA(nid); \ | ||
59 | __pgdat->node_start_pfn + __pgdat->node_spanned_pages; \ | ||
60 | }) | ||
61 | |||
62 | static inline int pfn_valid(int pfn) | 51 | static inline int pfn_valid(int pfn) |
63 | { | 52 | { |
64 | int nid = pfn_to_nid(pfn); | 53 | int nid = pfn_to_nid(pfn); |
diff --git a/arch/x86/include/asm/mmzone_64.h b/arch/x86/include/asm/mmzone_64.h index b3f88d7867c7..129d9aa3ceb3 100644 --- a/arch/x86/include/asm/mmzone_64.h +++ b/arch/x86/include/asm/mmzone_64.h | |||
@@ -13,8 +13,5 @@ extern struct pglist_data *node_data[]; | |||
13 | 13 | ||
14 | #define NODE_DATA(nid) (node_data[nid]) | 14 | #define NODE_DATA(nid) (node_data[nid]) |
15 | 15 | ||
16 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | ||
17 | #define node_end_pfn(nid) (NODE_DATA(nid)->node_start_pfn + \ | ||
18 | NODE_DATA(nid)->node_spanned_pages) | ||
19 | #endif | 16 | #endif |
20 | #endif /* _ASM_X86_MMZONE_64_H */ | 17 | #endif /* _ASM_X86_MMZONE_64_H */ |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index c928dac6cad0..9f7c3ebcbbad 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -647,6 +647,13 @@ typedef struct pglist_data { | |||
647 | #endif | 647 | #endif |
648 | #define nid_page_nr(nid, pagenr) pgdat_page_nr(NODE_DATA(nid),(pagenr)) | 648 | #define nid_page_nr(nid, pagenr) pgdat_page_nr(NODE_DATA(nid),(pagenr)) |
649 | 649 | ||
650 | #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn) | ||
651 | |||
652 | #define node_end_pfn(nid) ({\ | ||
653 | pg_data_t *__pgdat = NODE_DATA(nid);\ | ||
654 | __pgdat->node_start_pfn + __pgdat->node_spanned_pages;\ | ||
655 | }) | ||
656 | |||
650 | #include <linux/memory_hotplug.h> | 657 | #include <linux/memory_hotplug.h> |
651 | 658 | ||
652 | extern struct mutex zonelists_mutex; | 659 | extern struct mutex zonelists_mutex; |