numa.c (61e0e79ee3c609eb34edf2fe023708cba6a79b1f) | numa.c (e81703724a966120ace6504c993bda9e084cbf3e) |
---|---|
1/* 2 * pSeries NUMA support 3 * 4 * Copyright (C) 2002 Anton Blanchard <anton@au.ibm.com>, IBM 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version --- 102 unchanged lines hidden (view full) --- 111 return 1; 112 } 113 return 0; 114 115} 116 117/* 118 * get_node_active_region - Return active region containing start_pfn | 1/* 2 * pSeries NUMA support 3 * 4 * Copyright (C) 2002 Anton Blanchard <anton@au.ibm.com>, IBM 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version --- 102 unchanged lines hidden (view full) --- 111 return 1; 112 } 113 return 0; 114 115} 116 117/* 118 * get_node_active_region - Return active region containing start_pfn |
119 * Active range returned is empty if none found. |
|
119 * @start_pfn: The page to return the region for. 120 * @node_ar: Returned set to the active region containing start_pfn 121 */ 122static void __init get_node_active_region(unsigned long start_pfn, 123 struct node_active_region *node_ar) 124{ 125 int nid = early_pfn_to_nid(start_pfn); 126 127 node_ar->nid = nid; 128 node_ar->start_pfn = start_pfn; | 120 * @start_pfn: The page to return the region for. 121 * @node_ar: Returned set to the active region containing start_pfn 122 */ 123static void __init get_node_active_region(unsigned long start_pfn, 124 struct node_active_region *node_ar) 125{ 126 int nid = early_pfn_to_nid(start_pfn); 127 128 node_ar->nid = nid; 129 node_ar->start_pfn = start_pfn; |
130 node_ar->end_pfn = start_pfn; |
|
129 work_with_active_regions(nid, get_active_region_work_fn, node_ar); 130} 131 132static void __cpuinit map_cpu_to_node(int cpu, int node) 133{ 134 numa_cpu_lookup_table[cpu] = node; 135 136 dbg("adding cpu %d to node %d\n", cpu, node); --- 791 unchanged lines hidden (view full) --- 928 for (i = 0; i < lmb.reserved.cnt; i++) { 929 unsigned long physbase = lmb.reserved.region[i].base; 930 unsigned long size = lmb.reserved.region[i].size; 931 unsigned long start_pfn = physbase >> PAGE_SHIFT; 932 unsigned long end_pfn = ((physbase + size) >> PAGE_SHIFT); 933 struct node_active_region node_ar; 934 935 get_node_active_region(start_pfn, &node_ar); | 131 work_with_active_regions(nid, get_active_region_work_fn, node_ar); 132} 133 134static void __cpuinit map_cpu_to_node(int cpu, int node) 135{ 136 numa_cpu_lookup_table[cpu] = node; 137 138 dbg("adding cpu %d to node %d\n", cpu, node); --- 791 unchanged lines hidden (view full) --- 930 for (i = 0; i < lmb.reserved.cnt; i++) { 931 unsigned long physbase = lmb.reserved.region[i].base; 932 unsigned long size = lmb.reserved.region[i].size; 933 unsigned long start_pfn = physbase >> PAGE_SHIFT; 934 unsigned long end_pfn = ((physbase + size) >> PAGE_SHIFT); 935 struct node_active_region node_ar; 936 937 get_node_active_region(start_pfn, &node_ar); |
936 while (start_pfn < end_pfn) { | 938 while (start_pfn < end_pfn && 939 node_ar.start_pfn < node_ar.end_pfn) { 940 unsigned long reserve_size = size; |
937 /* 938 * if reserved region extends past active region 939 * then trim size to active region 940 */ 941 if (end_pfn > node_ar.end_pfn) | 941 /* 942 * if reserved region extends past active region 943 * then trim size to active region 944 */ 945 if (end_pfn > node_ar.end_pfn) |
942 size = (node_ar.end_pfn << PAGE_SHIFT) | 946 reserve_size = (node_ar.end_pfn << PAGE_SHIFT) |
943 - (start_pfn << PAGE_SHIFT); | 947 - (start_pfn << PAGE_SHIFT); |
944 dbg("reserve_bootmem %lx %lx nid=%d\n", physbase, size, 945 node_ar.nid); | 948 dbg("reserve_bootmem %lx %lx nid=%d\n", physbase, 949 reserve_size, node_ar.nid); |
946 reserve_bootmem_node(NODE_DATA(node_ar.nid), physbase, | 950 reserve_bootmem_node(NODE_DATA(node_ar.nid), physbase, |
947 size, BOOTMEM_DEFAULT); | 951 reserve_size, BOOTMEM_DEFAULT); |
948 /* 949 * if reserved region is contained in the active region 950 * then done. 951 */ 952 if (end_pfn <= node_ar.end_pfn) 953 break; 954 955 /* 956 * reserved region extends past the active region 957 * get next active region that contains this 958 * reserved region 959 */ 960 start_pfn = node_ar.end_pfn; 961 physbase = start_pfn << PAGE_SHIFT; | 952 /* 953 * if reserved region is contained in the active region 954 * then done. 955 */ 956 if (end_pfn <= node_ar.end_pfn) 957 break; 958 959 /* 960 * reserved region extends past the active region 961 * get next active region that contains this 962 * reserved region 963 */ 964 start_pfn = node_ar.end_pfn; 965 physbase = start_pfn << PAGE_SHIFT; |
966 size = size - reserve_size; |
|
962 get_node_active_region(start_pfn, &node_ar); 963 } 964 965 } 966 967 for_each_online_node(nid) 968 sparse_memory_present_with_active_regions(nid); 969} --- 151 unchanged lines hidden --- | 967 get_node_active_region(start_pfn, &node_ar); 968 } 969 970 } 971 972 for_each_online_node(nid) 973 sparse_memory_present_with_active_regions(nid); 974} --- 151 unchanged lines hidden --- |