aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-04-04 18:23:56 -0400
committerH. Peter Anvin <hpa@zytor.com>2011-04-06 20:57:33 -0400
commit2a286344f06d6341740b284494379373e87648f7 (patch)
tree6675240cacfaeb24741ed01092eb029725ab8c18 /arch/x86/mm
parent0e9f93c1c04c8ab10cc564df54a7ad0f83c67796 (diff)
x86-32, numa: Move remapping for remap allocator into init_alloc_remap()
There's no reason to perform the actual remapping separately. Collapse remap_numa_kva() into init_alloc_remap() and, while at it, make it less verbose. Signed-off-by: Tejun Heo <tj@kernel.org> Link: http://lkml.kernel.org/r/1301955840-7246-11-git-send-email-tj@kernel.org Acked-by: Yinghai Lu <yinghai@kernel.org> Cc: David Rientjes <rientjes@google.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/numa_32.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
index 12bb34c434ea..53ec13a17b9a 100644
--- a/arch/x86/mm/numa_32.c
+++ b/arch/x86/mm/numa_32.c
@@ -205,26 +205,6 @@ void *alloc_remap(int nid, unsigned long size)
205 return allocation; 205 return allocation;
206} 206}
207 207
208static void __init remap_numa_kva(void)
209{
210 void *vaddr;
211 unsigned long pfn;
212 int node;
213
214 for_each_online_node(node) {
215 printk(KERN_DEBUG "remap_numa_kva: node %d\n", node);
216 for (pfn=0; pfn < node_remap_size[node]; pfn += PTRS_PER_PTE) {
217 vaddr = node_remap_start_vaddr[node]+(pfn<<PAGE_SHIFT);
218 printk(KERN_DEBUG "remap_numa_kva: %08lx to pfn %08lx\n",
219 (unsigned long)vaddr,
220 node_remap_start_pfn[node] + pfn);
221 set_pmd_pfn((ulong) vaddr,
222 node_remap_start_pfn[node] + pfn,
223 PAGE_KERNEL_LARGE);
224 }
225 }
226}
227
228#ifdef CONFIG_HIBERNATION 208#ifdef CONFIG_HIBERNATION
229/** 209/**
230 * resume_map_numa_kva - add KVA mapping to the temporary page tables created 210 * resume_map_numa_kva - add KVA mapping to the temporary page tables created
@@ -262,7 +242,7 @@ void resume_map_numa_kva(pgd_t *pgd_base)
262 242
263static __init unsigned long init_alloc_remap(int nid, unsigned long offset) 243static __init unsigned long init_alloc_remap(int nid, unsigned long offset)
264{ 244{
265 unsigned long size; 245 unsigned long size, pfn;
266 u64 node_pa, remap_pa; 246 u64 node_pa, remap_pa;
267 void *remap_va; 247 void *remap_va;
268 248
@@ -308,6 +288,12 @@ static __init unsigned long init_alloc_remap(int nid, unsigned long offset)
308 memblock_x86_reserve_range(remap_pa, remap_pa + size, "KVA PG"); 288 memblock_x86_reserve_range(remap_pa, remap_pa + size, "KVA PG");
309 remap_va = phys_to_virt(remap_pa); 289 remap_va = phys_to_virt(remap_pa);
310 290
291 /* perform actual remap */
292 for (pfn = 0; pfn < size >> PAGE_SHIFT; pfn += PTRS_PER_PTE)
293 set_pmd_pfn((unsigned long)remap_va + (pfn << PAGE_SHIFT),
294 (node_pa >> PAGE_SHIFT) + pfn,
295 PAGE_KERNEL_LARGE);
296
311 /* initialize remap allocator parameters */ 297 /* initialize remap allocator parameters */
312 node_remap_start_pfn[nid] = node_pa >> PAGE_SHIFT; 298 node_remap_start_pfn[nid] = node_pa >> PAGE_SHIFT;
313 node_remap_size[nid] = size >> PAGE_SHIFT; 299 node_remap_size[nid] = size >> PAGE_SHIFT;
@@ -363,7 +349,6 @@ void __init initmem_init(void)
363 (ulong) pfn_to_kaddr(max_low_pfn)); 349 (ulong) pfn_to_kaddr(max_low_pfn));
364 for_each_online_node(nid) 350 for_each_online_node(nid)
365 allocate_pgdat(nid); 351 allocate_pgdat(nid);
366 remap_numa_kva();
367 352
368 printk(KERN_DEBUG "High memory starts at vaddr %08lx\n", 353 printk(KERN_DEBUG "High memory starts at vaddr %08lx\n",
369 (ulong) pfn_to_kaddr(highstart_pfn)); 354 (ulong) pfn_to_kaddr(highstart_pfn));