27 #include <linux/module.h>
31 #ifdef CONFIG_DISCONTIGMEM
44 s8 physnode_map[MAX_SECTIONS]
__read_mostly = { [0 ... (MAX_SECTIONS - 1)] = -1};
53 printk(
KERN_DEBUG " Setting physnode_map array to node %d for pfns:\n", nid);
55 for (pfn = start; pfn <
end; pfn += PAGES_PER_SECTION) {
56 physnode_map[pfn / PAGES_PER_SECTION] = nid;
63 unsigned long end_pfn)
65 unsigned long nr_pages = end_pfn - start_pfn;
70 return (nr_pages + 1) *
sizeof(
struct page);
76 #define LARGE_PAGE_BYTES (PTRS_PER_PTE * PAGE_SIZE)
109 void *allocation = node_remap_alloc_vaddr[nid];
113 if (!allocation || (allocation + size) > node_remap_end_vaddr[nid])
116 node_remap_alloc_vaddr[nid] +=
size;
117 memset(allocation, 0, size);
122 #ifdef CONFIG_HIBERNATION
128 void resume_map_numa_kva(
pgd_t *pgd_base)
133 unsigned long start_va, start_pfn, nr_pages, pfn;
135 start_va = (
unsigned long)node_remap_start_vaddr[node];
136 start_pfn = node_remap_start_pfn[
node];
137 nr_pages = (node_remap_end_vaddr[
node] -
152 __func__, vaddr, start_pfn + pfn);
182 unsigned long start_pfn = start >>
PAGE_SHIFT;
184 unsigned long size, pfn;
185 u64 node_pa, remap_pa;
193 nid, start_pfn, end_pfn);
203 pr_warning(
"remap_alloc: failed to allocate %lu bytes for node %d\n",
213 pr_warning(
"remap_alloc: failed to allocate %lu bytes remap area for node %d\n",
223 set_pmd_pfn((
unsigned long)remap_va + (pfn << PAGE_SHIFT),
224 (node_pa >> PAGE_SHIFT) + pfn,
228 node_remap_start_pfn[nid] = node_pa >>
PAGE_SHIFT;
229 node_remap_start_vaddr[nid] = remap_va;
230 node_remap_end_vaddr[nid] = remap_va +
size;
231 node_remap_alloc_vaddr[nid] = remap_va;
234 nid, node_pa, node_pa + size, remap_va, remap_va + size);
241 #ifdef CONFIG_HIGHMEM
242 highstart_pfn = highend_pfn =
max_pfn;