diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-05-23 04:48:36 -0400 |
---|---|---|
committer | Paul Mundt <lethal@hera.kernel.org> | 2007-06-07 22:43:43 -0400 |
commit | dfbb9042801eaeb4df9015bb86224291a39a0f52 (patch) | |
tree | fc762c923fbc48bd724e648ccb415307ba17086c /arch/sh/mm/init.c | |
parent | 5900711ad7173b1cf3ee72eb21572e20b263ca0d (diff) |
sh: sparsemem support.
This implements basic sparsemem support for SH. Presently this only
uses static sparsemem, and we still permit explicit selection of
flatmem. Those boards that want sparsemem can select it as usual.
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, 6 insertions, 23 deletions
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index e0e644ff3204..1589466f9f87 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c | |||
@@ -36,14 +36,11 @@ void show_mem(void) | |||
36 | show_free_areas(); | 36 | show_free_areas(); |
37 | 37 | ||
38 | for_each_online_pgdat(pgdat) { | 38 | for_each_online_pgdat(pgdat) { |
39 | struct page *page, *end; | 39 | unsigned long flags, i; |
40 | unsigned long flags; | ||
41 | 40 | ||
42 | pgdat_resize_lock(pgdat, &flags); | 41 | pgdat_resize_lock(pgdat, &flags); |
43 | page = pgdat->node_mem_map; | 42 | for (i = 0; i < pgdat->node_spanned_pages; i++) { |
44 | end = page + pgdat->node_spanned_pages; | 43 | struct page *page = pgdat_page_nr(pgdat, i); |
45 | |||
46 | do { | ||
47 | total++; | 44 | total++; |
48 | if (PageReserved(page)) | 45 | if (PageReserved(page)) |
49 | reserved++; | 46 | reserved++; |
@@ -55,9 +52,7 @@ void show_mem(void) | |||
55 | free++; | 52 | free++; |
56 | else | 53 | else |
57 | shared += page_count(page) - 1; | 54 | shared += page_count(page) - 1; |
58 | page++; | 55 | } |
59 | } while (page < end); | ||
60 | |||
61 | pgdat_resize_unlock(pgdat, &flags); | 56 | pgdat_resize_unlock(pgdat, &flags); |
62 | } | 57 | } |
63 | 58 | ||
@@ -169,15 +164,11 @@ void __init paging_init(void) | |||
169 | low = pgdat->bdata->node_low_pfn; | 164 | low = pgdat->bdata->node_low_pfn; |
170 | 165 | ||
171 | max_zone_pfns[ZONE_NORMAL] = low; | 166 | max_zone_pfns[ZONE_NORMAL] = low; |
172 | add_active_range(nid, start_pfn, low); | ||
173 | 167 | ||
174 | printk("Node %u: start_pfn = 0x%lx, low = 0x%lx\n", | 168 | printk("Node %u: start_pfn = 0x%lx, low = 0x%lx\n", |
175 | nid, start_pfn, low); | 169 | nid, start_pfn, low); |
176 | 170 | ||
177 | free_area_init_nodes(max_zone_pfns); | 171 | free_area_init_nodes(max_zone_pfns); |
178 | |||
179 | printk("Node %u: mem_map starts at %p\n", | ||
180 | pgdat->node_id, pgdat->node_mem_map); | ||
181 | } | 172 | } |
182 | } | 173 | } |
183 | 174 | ||
@@ -185,16 +176,13 @@ static struct kcore_list kcore_mem, kcore_vmalloc; | |||
185 | 176 | ||
186 | void __init mem_init(void) | 177 | void __init mem_init(void) |
187 | { | 178 | { |
188 | int codesize, reservedpages, datasize, initsize; | 179 | int codesize, datasize, initsize; |
189 | int nid; | 180 | int nid; |
190 | 181 | ||
191 | reservedpages = 0; | ||
192 | |||
193 | for_each_online_node(nid) { | 182 | for_each_online_node(nid) { |
194 | pg_data_t *pgdat = NODE_DATA(nid); | 183 | pg_data_t *pgdat = NODE_DATA(nid); |
195 | unsigned long node_pages = 0; | 184 | unsigned long node_pages = 0; |
196 | void *node_high_memory; | 185 | void *node_high_memory; |
197 | int i; | ||
198 | 186 | ||
199 | num_physpages += pgdat->node_present_pages; | 187 | num_physpages += pgdat->node_present_pages; |
200 | 188 | ||
@@ -203,10 +191,6 @@ void __init mem_init(void) | |||
203 | 191 | ||
204 | totalram_pages += node_pages; | 192 | totalram_pages += node_pages; |
205 | 193 | ||
206 | for (i = 0; i < node_pages; i++) | ||
207 | if (PageReserved(pgdat->node_mem_map + i)) | ||
208 | reservedpages++; | ||
209 | |||
210 | node_high_memory = (void *)((pgdat->node_start_pfn + | 194 | node_high_memory = (void *)((pgdat->node_start_pfn + |
211 | pgdat->node_spanned_pages) << | 195 | pgdat->node_spanned_pages) << |
212 | PAGE_SHIFT); | 196 | PAGE_SHIFT); |
@@ -239,11 +223,10 @@ void __init mem_init(void) | |||
239 | VMALLOC_END - VMALLOC_START); | 223 | VMALLOC_END - VMALLOC_START); |
240 | 224 | ||
241 | printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " | 225 | printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, " |
242 | "%dk reserved, %dk data, %dk init)\n", | 226 | "%dk data, %dk init)\n", |
243 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), | 227 | (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), |
244 | totalram_pages << (PAGE_SHIFT-10), | 228 | totalram_pages << (PAGE_SHIFT-10), |
245 | codesize >> 10, | 229 | codesize >> 10, |
246 | reservedpages << (PAGE_SHIFT-10), | ||
247 | datasize >> 10, | 230 | datasize >> 10, |
248 | initsize >> 10); | 231 | initsize >> 10); |
249 | 232 | ||