diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-06-05 23:09:54 -0400 |
---|---|---|
committer | Paul Mundt <lethal@hera.kernel.org> | 2007-06-07 22:43:48 -0400 |
commit | 2de212ebd8d5c1a17e40bffcc7e434443105c4b8 (patch) | |
tree | 12fa53997af8a8eb4b5384e07d07381888e28504 /arch/sh/mm/init.c | |
parent | cbd2d9d8fcd9d2a46d71d0703a76773c20383c66 (diff) |
sh: Fix up max_zone_pfns[] with multiple nodes.
Currently using multiple nodes tramples the ZONE_NORMAL
max low pfn, tidy up the logic a bit to get it all working
as expected.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/mm/init.c')
-rw-r--r-- | arch/sh/mm/init.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index 1589466f9f87..2032b39c229a 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c | |||
@@ -142,6 +142,7 @@ extern char __init_begin, __init_end; | |||
142 | */ | 142 | */ |
143 | void __init paging_init(void) | 143 | void __init paging_init(void) |
144 | { | 144 | { |
145 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | ||
145 | int nid; | 146 | int nid; |
146 | 147 | ||
147 | /* We don't need to map the kernel through the TLB, as | 148 | /* We don't need to map the kernel through the TLB, as |
@@ -153,23 +154,23 @@ void __init paging_init(void) | |||
153 | * check for a null value. */ | 154 | * check for a null value. */ |
154 | set_TTB(swapper_pg_dir); | 155 | set_TTB(swapper_pg_dir); |
155 | 156 | ||
157 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | ||
158 | |||
156 | for_each_online_node(nid) { | 159 | for_each_online_node(nid) { |
157 | pg_data_t *pgdat = NODE_DATA(nid); | 160 | pg_data_t *pgdat = NODE_DATA(nid); |
158 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | ||
159 | unsigned long low, start_pfn; | 161 | unsigned long low, start_pfn; |
160 | 162 | ||
161 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | ||
162 | |||
163 | start_pfn = pgdat->bdata->node_boot_start >> PAGE_SHIFT; | 163 | start_pfn = pgdat->bdata->node_boot_start >> PAGE_SHIFT; |
164 | low = pgdat->bdata->node_low_pfn; | 164 | low = pgdat->bdata->node_low_pfn; |
165 | 165 | ||
166 | max_zone_pfns[ZONE_NORMAL] = low; | 166 | if (max_zone_pfns[ZONE_NORMAL] < low) |
167 | max_zone_pfns[ZONE_NORMAL] = low; | ||
167 | 168 | ||
168 | printk("Node %u: start_pfn = 0x%lx, low = 0x%lx\n", | 169 | printk("Node %u: start_pfn = 0x%lx, low = 0x%lx\n", |
169 | nid, start_pfn, low); | 170 | nid, start_pfn, low); |
170 | |||
171 | free_area_init_nodes(max_zone_pfns); | ||
172 | } | 171 | } |
172 | |||
173 | free_area_init_nodes(max_zone_pfns); | ||
173 | } | 174 | } |
174 | 175 | ||
175 | static struct kcore_list kcore_mem, kcore_vmalloc; | 176 | static struct kcore_list kcore_mem, kcore_vmalloc; |
@@ -179,6 +180,9 @@ void __init mem_init(void) | |||
179 | int codesize, datasize, initsize; | 180 | int codesize, datasize, initsize; |
180 | int nid; | 181 | int nid; |
181 | 182 | ||
183 | num_physpages = 0; | ||
184 | high_memory = NULL; | ||
185 | |||
182 | for_each_online_node(nid) { | 186 | for_each_online_node(nid) { |
183 | pg_data_t *pgdat = NODE_DATA(nid); | 187 | pg_data_t *pgdat = NODE_DATA(nid); |
184 | unsigned long node_pages = 0; | 188 | unsigned long node_pages = 0; |
@@ -191,9 +195,9 @@ void __init mem_init(void) | |||
191 | 195 | ||
192 | totalram_pages += node_pages; | 196 | totalram_pages += node_pages; |
193 | 197 | ||
194 | node_high_memory = (void *)((pgdat->node_start_pfn + | 198 | node_high_memory = (void *)__va((pgdat->node_start_pfn + |
195 | pgdat->node_spanned_pages) << | 199 | pgdat->node_spanned_pages) << |
196 | PAGE_SHIFT); | 200 | PAGE_SHIFT); |
197 | if (node_high_memory > high_memory) | 201 | if (node_high_memory > high_memory) |
198 | high_memory = node_high_memory; | 202 | high_memory = node_high_memory; |
199 | } | 203 | } |
@@ -225,7 +229,7 @@ void __init mem_init(void) | |||
225 | printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " | 229 | printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " |
226 | "%dk data, %dk init)\n", | 230 | "%dk data, %dk init)\n", |
227 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), | 231 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), |
228 | totalram_pages << (PAGE_SHIFT-10), | 232 | num_physpages << (PAGE_SHIFT-10), |
229 | codesize >> 10, | 233 | codesize >> 10, |
230 | datasize >> 10, | 234 | datasize >> 10, |
231 | initsize >> 10); | 235 | initsize >> 10); |
@@ -247,7 +251,8 @@ void free_initmem(void) | |||
247 | free_page(addr); | 251 | free_page(addr); |
248 | totalram_pages++; | 252 | totalram_pages++; |
249 | } | 253 | } |
250 | printk ("Freeing unused kernel memory: %dk freed\n", (&__init_end - &__init_begin) >> 10); | 254 | printk("Freeing unused kernel memory: %dk freed\n", |
255 | (&__init_end - &__init_begin) >> 10); | ||
251 | } | 256 | } |
252 | 257 | ||
253 | #ifdef CONFIG_BLK_DEV_INITRD | 258 | #ifdef CONFIG_BLK_DEV_INITRD |
@@ -260,6 +265,6 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
260 | free_page(p); | 265 | free_page(p); |
261 | totalram_pages++; | 266 | totalram_pages++; |
262 | } | 267 | } |
263 | printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); | 268 | printk("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); |
264 | } | 269 | } |
265 | #endif | 270 | #endif |