summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/include/asm/topology.h3
-rw-r--r--arch/ia64/kernel/numa.c2
-rw-r--r--arch/ia64/mm/discontig.c6
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h3
-rw-r--r--arch/powerpc/kernel/paca.c3
-rw-r--r--arch/powerpc/kernel/pci-common.c3
-rw-r--r--arch/powerpc/mm/numa.c14
-rw-r--r--arch/powerpc/platforms/powernv/memtrace.c5
-rw-r--r--arch/sparc/kernel/pci_fire.c3
-rw-r--r--arch/sparc/kernel/pci_schizo.c3
-rw-r--r--arch/sparc/kernel/psycho_common.c3
-rw-r--r--arch/sparc/kernel/sbus.c3
-rw-r--r--arch/sparc/mm/init_64.c6
-rw-r--r--arch/x86/include/asm/pci.h3
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c7
-rw-r--r--arch/x86/kernel/smpboot.c3
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c5
-rw-r--r--drivers/dma/dmaengine.c4
-rw-r--r--drivers/infiniband/hw/hfi1/affinity.c3
-rw-r--r--drivers/infiniband/hw/hfi1/init.c3
-rw-r--r--drivers/iommu/dmar.c5
-rw-r--r--drivers/iommu/intel-iommu.c3
-rw-r--r--drivers/misc/sgi-xp/xpc_uv.c3
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c5
-rw-r--r--include/linux/device.h2
-rw-r--r--init/init_task.c3
-rw-r--r--kernel/kthread.c3
-rw-r--r--kernel/sched/fair.c15
-rw-r--r--lib/cpumask.c3
-rw-r--r--mm/huge_memory.c13
-rw-r--r--mm/hugetlb.c3
-rw-r--r--mm/ksm.c2
-rw-r--r--mm/memory.c7
-rw-r--r--mm/memory_hotplug.c12
-rw-r--r--mm/mempolicy.c2
-rw-r--r--mm/page_alloc.c4
-rw-r--r--mm/page_ext.c2
-rw-r--r--net/core/pktgen.c3
-rw-r--r--net/qrtr/qrtr.c3
39 files changed, 104 insertions, 74 deletions
diff --git a/arch/alpha/include/asm/topology.h b/arch/alpha/include/asm/topology.h
index e6e13a85796a..5a77a40567fa 100644
--- a/arch/alpha/include/asm/topology.h
+++ b/arch/alpha/include/asm/topology.h
@@ -4,6 +4,7 @@
4 4
5#include <linux/smp.h> 5#include <linux/smp.h>
6#include <linux/threads.h> 6#include <linux/threads.h>
7#include <linux/numa.h>
7#include <asm/machvec.h> 8#include <asm/machvec.h>
8 9
9#ifdef CONFIG_NUMA 10#ifdef CONFIG_NUMA
@@ -29,7 +30,7 @@ static const struct cpumask *cpumask_of_node(int node)
29{ 30{
30 int cpu; 31 int cpu;
31 32
32 if (node == -1) 33 if (node == NUMA_NO_NODE)
33 return cpu_all_mask; 34 return cpu_all_mask;
34 35
35 cpumask_clear(&node_to_cpumask_map[node]); 36 cpumask_clear(&node_to_cpumask_map[node]);
diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c
index 92c376279c6d..1315da6c7aeb 100644
--- a/arch/ia64/kernel/numa.c
+++ b/arch/ia64/kernel/numa.c
@@ -74,7 +74,7 @@ void __init build_cpu_to_node_map(void)
74 cpumask_clear(&node_to_cpu_mask[node]); 74 cpumask_clear(&node_to_cpu_mask[node]);
75 75
76 for_each_possible_early_cpu(cpu) { 76 for_each_possible_early_cpu(cpu) {
77 node = -1; 77 node = NUMA_NO_NODE;
78 for (i = 0; i < NR_CPUS; ++i) 78 for (i = 0; i < NR_CPUS; ++i)
79 if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) { 79 if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
80 node = node_cpuid[i].nid; 80 node = node_cpuid[i].nid;
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 8a965784340c..f9c36750c6a4 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -227,7 +227,7 @@ void __init setup_per_cpu_areas(void)
227 * CPUs are put into groups according to node. Walk cpu_map 227 * CPUs are put into groups according to node. Walk cpu_map
228 * and create new groups at node boundaries. 228 * and create new groups at node boundaries.
229 */ 229 */
230 prev_node = -1; 230 prev_node = NUMA_NO_NODE;
231 ai->nr_groups = 0; 231 ai->nr_groups = 0;
232 for (unit = 0; unit < nr_units; unit++) { 232 for (unit = 0; unit < nr_units; unit++) {
233 cpu = cpu_map[unit]; 233 cpu = cpu_map[unit];
@@ -435,7 +435,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
435{ 435{
436 void *ptr = NULL; 436 void *ptr = NULL;
437 u8 best = 0xff; 437 u8 best = 0xff;
438 int bestnode = -1, node, anynode = 0; 438 int bestnode = NUMA_NO_NODE, node, anynode = 0;
439 439
440 for_each_online_node(node) { 440 for_each_online_node(node) {
441 if (node_isset(node, memory_less_mask)) 441 if (node_isset(node, memory_less_mask))
@@ -447,7 +447,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
447 anynode = node; 447 anynode = node;
448 } 448 }
449 449
450 if (bestnode == -1) 450 if (bestnode == NUMA_NO_NODE)
451 bestnode = anynode; 451 bestnode = anynode;
452 452
453 ptr = memblock_alloc_try_nid(pernodesize, PERCPU_PAGE_SIZE, 453 ptr = memblock_alloc_try_nid(pernodesize, PERCPU_PAGE_SIZE,
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index aee4fcc24990..77fc21278fa2 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -10,6 +10,7 @@
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <linux/list.h> 11#include <linux/list.h>
12#include <linux/ioport.h> 12#include <linux/ioport.h>
13#include <linux/numa.h>
13 14
14struct device_node; 15struct device_node;
15 16
@@ -265,7 +266,7 @@ extern int pcibios_map_io_space(struct pci_bus *bus);
265#ifdef CONFIG_NUMA 266#ifdef CONFIG_NUMA
266#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = (NODE)) 267#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = (NODE))
267#else 268#else
268#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = -1) 269#define PHB_SET_NODE(PHB, NODE) ((PHB)->node = NUMA_NO_NODE)
269#endif 270#endif
270 271
271#endif /* CONFIG_PPC64 */ 272#endif /* CONFIG_PPC64 */
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 913bfca09c4f..b8480127793d 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -11,6 +11,7 @@
11#include <linux/export.h> 11#include <linux/export.h>
12#include <linux/memblock.h> 12#include <linux/memblock.h>
13#include <linux/sched/task.h> 13#include <linux/sched/task.h>
14#include <linux/numa.h>
14 15
15#include <asm/lppaca.h> 16#include <asm/lppaca.h>
16#include <asm/paca.h> 17#include <asm/paca.h>
@@ -36,7 +37,7 @@ static void *__init alloc_paca_data(unsigned long size, unsigned long align,
36 * which will put its paca in the right place. 37 * which will put its paca in the right place.
37 */ 38 */
38 if (cpu == boot_cpuid) { 39 if (cpu == boot_cpuid) {
39 nid = -1; 40 nid = NUMA_NO_NODE;
40 memblock_set_bottom_up(true); 41 memblock_set_bottom_up(true);
41 } else { 42 } else {
42 nid = early_cpu_to_node(cpu); 43 nid = early_cpu_to_node(cpu);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 88e4f69a09e5..4538e8ddde80 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -32,6 +32,7 @@
32#include <linux/vmalloc.h> 32#include <linux/vmalloc.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/vgaarb.h> 34#include <linux/vgaarb.h>
35#include <linux/numa.h>
35 36
36#include <asm/processor.h> 37#include <asm/processor.h>
37#include <asm/io.h> 38#include <asm/io.h>
@@ -132,7 +133,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
132 int nid = of_node_to_nid(dev); 133 int nid = of_node_to_nid(dev);
133 134
134 if (nid < 0 || !node_online(nid)) 135 if (nid < 0 || !node_online(nid))
135 nid = -1; 136 nid = NUMA_NO_NODE;
136 137
137 PHB_SET_NODE(phb, nid); 138 PHB_SET_NODE(phb, nid);
138 } 139 }
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 87f0dd004295..270cefb75cca 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -215,7 +215,7 @@ static void initialize_distance_lookup_table(int nid,
215 */ 215 */
216static int associativity_to_nid(const __be32 *associativity) 216static int associativity_to_nid(const __be32 *associativity)
217{ 217{
218 int nid = -1; 218 int nid = NUMA_NO_NODE;
219 219
220 if (min_common_depth == -1) 220 if (min_common_depth == -1)
221 goto out; 221 goto out;
@@ -225,7 +225,7 @@ static int associativity_to_nid(const __be32 *associativity)
225 225
226 /* POWER4 LPAR uses 0xffff as invalid node */ 226 /* POWER4 LPAR uses 0xffff as invalid node */
227 if (nid == 0xffff || nid >= MAX_NUMNODES) 227 if (nid == 0xffff || nid >= MAX_NUMNODES)
228 nid = -1; 228 nid = NUMA_NO_NODE;
229 229
230 if (nid > 0 && 230 if (nid > 0 &&
231 of_read_number(associativity, 1) >= distance_ref_points_depth) { 231 of_read_number(associativity, 1) >= distance_ref_points_depth) {
@@ -244,7 +244,7 @@ out:
244 */ 244 */
245static int of_node_to_nid_single(struct device_node *device) 245static int of_node_to_nid_single(struct device_node *device)
246{ 246{
247 int nid = -1; 247 int nid = NUMA_NO_NODE;
248 const __be32 *tmp; 248 const __be32 *tmp;
249 249
250 tmp = of_get_associativity(device); 250 tmp = of_get_associativity(device);
@@ -256,7 +256,7 @@ static int of_node_to_nid_single(struct device_node *device)
256/* Walk the device tree upwards, looking for an associativity id */ 256/* Walk the device tree upwards, looking for an associativity id */
257int of_node_to_nid(struct device_node *device) 257int of_node_to_nid(struct device_node *device)
258{ 258{
259 int nid = -1; 259 int nid = NUMA_NO_NODE;
260 260
261 of_node_get(device); 261 of_node_get(device);
262 while (device) { 262 while (device) {
@@ -454,7 +454,7 @@ static int of_drconf_to_nid_single(struct drmem_lmb *lmb)
454 */ 454 */
455static int numa_setup_cpu(unsigned long lcpu) 455static int numa_setup_cpu(unsigned long lcpu)
456{ 456{
457 int nid = -1; 457 int nid = NUMA_NO_NODE;
458 struct device_node *cpu; 458 struct device_node *cpu;
459 459
460 /* 460 /*
@@ -930,7 +930,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
930{ 930{
931 struct drmem_lmb *lmb; 931 struct drmem_lmb *lmb;
932 unsigned long lmb_size; 932 unsigned long lmb_size;
933 int nid = -1; 933 int nid = NUMA_NO_NODE;
934 934
935 lmb_size = drmem_lmb_size(); 935 lmb_size = drmem_lmb_size();
936 936
@@ -960,7 +960,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
960static int hot_add_node_scn_to_nid(unsigned long scn_addr) 960static int hot_add_node_scn_to_nid(unsigned long scn_addr)
961{ 961{
962 struct device_node *memory; 962 struct device_node *memory;
963 int nid = -1; 963 int nid = NUMA_NO_NODE;
964 964
965 for_each_node_by_type(memory, "memory") { 965 for_each_node_by_type(memory, "memory") {
966 unsigned long start, size; 966 unsigned long start, size;
diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
index 84d038ed3882..248a38ad25c7 100644
--- a/arch/powerpc/platforms/powernv/memtrace.c
+++ b/arch/powerpc/platforms/powernv/memtrace.c
@@ -20,6 +20,7 @@
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/memory.h> 21#include <linux/memory.h>
22#include <linux/memory_hotplug.h> 22#include <linux/memory_hotplug.h>
23#include <linux/numa.h>
23#include <asm/machdep.h> 24#include <asm/machdep.h>
24#include <asm/debugfs.h> 25#include <asm/debugfs.h>
25 26
@@ -223,7 +224,7 @@ static int memtrace_online(void)
223 ent = &memtrace_array[i]; 224 ent = &memtrace_array[i];
224 225
225 /* We have onlined this chunk previously */ 226 /* We have onlined this chunk previously */
226 if (ent->nid == -1) 227 if (ent->nid == NUMA_NO_NODE)
227 continue; 228 continue;
228 229
229 /* Remove from io mappings */ 230 /* Remove from io mappings */
@@ -257,7 +258,7 @@ static int memtrace_online(void)
257 */ 258 */
258 debugfs_remove_recursive(ent->dir); 259 debugfs_remove_recursive(ent->dir);
259 pr_info("Added trace memory back to node %d\n", ent->nid); 260 pr_info("Added trace memory back to node %d\n", ent->nid);
260 ent->size = ent->start = ent->nid = -1; 261 ent->size = ent->start = ent->nid = NUMA_NO_NODE;
261 } 262 }
262 if (ret) 263 if (ret)
263 return ret; 264 return ret;
diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index be71ae086622..0ca08d455e80 100644
--- a/arch/sparc/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
@@ -11,6 +11,7 @@
11#include <linux/export.h> 11#include <linux/export.h>
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <linux/of_device.h> 13#include <linux/of_device.h>
14#include <linux/numa.h>
14 15
15#include <asm/prom.h> 16#include <asm/prom.h>
16#include <asm/irq.h> 17#include <asm/irq.h>
@@ -416,7 +417,7 @@ static int pci_fire_pbm_init(struct pci_pbm_info *pbm,
416 struct device_node *dp = op->dev.of_node; 417 struct device_node *dp = op->dev.of_node;
417 int err; 418 int err;
418 419
419 pbm->numa_node = -1; 420 pbm->numa_node = NUMA_NO_NODE;
420 421
421 pbm->pci_ops = &sun4u_pci_ops; 422 pbm->pci_ops = &sun4u_pci_ops;
422 pbm->config_space_reg_bits = 12; 423 pbm->config_space_reg_bits = 12;
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 934b97c72f7c..421aba00e6b0 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -12,6 +12,7 @@
12#include <linux/export.h> 12#include <linux/export.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/of_device.h> 14#include <linux/of_device.h>
15#include <linux/numa.h>
15 16
16#include <asm/iommu.h> 17#include <asm/iommu.h>
17#include <asm/irq.h> 18#include <asm/irq.h>
@@ -1347,7 +1348,7 @@ static int schizo_pbm_init(struct pci_pbm_info *pbm,
1347 pbm->next = pci_pbm_root; 1348 pbm->next = pci_pbm_root;
1348 pci_pbm_root = pbm; 1349 pci_pbm_root = pbm;
1349 1350
1350 pbm->numa_node = -1; 1351 pbm->numa_node = NUMA_NO_NODE;
1351 1352
1352 pbm->pci_ops = &sun4u_pci_ops; 1353 pbm->pci_ops = &sun4u_pci_ops;
1353 pbm->config_space_reg_bits = 8; 1354 pbm->config_space_reg_bits = 8;
diff --git a/arch/sparc/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
index 81aa91e5c0e6..e90bcb6bad7f 100644
--- a/arch/sparc/kernel/psycho_common.c
+++ b/arch/sparc/kernel/psycho_common.c
@@ -5,6 +5,7 @@
5 */ 5 */
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/interrupt.h> 7#include <linux/interrupt.h>
8#include <linux/numa.h>
8 9
9#include <asm/upa.h> 10#include <asm/upa.h>
10 11
@@ -454,7 +455,7 @@ void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct platform_device *op
454 struct device_node *dp = op->dev.of_node; 455 struct device_node *dp = op->dev.of_node;
455 456
456 pbm->name = dp->full_name; 457 pbm->name = dp->full_name;
457 pbm->numa_node = -1; 458 pbm->numa_node = NUMA_NO_NODE;
458 pbm->chip_type = chip_type; 459 pbm->chip_type = chip_type;
459 pbm->chip_version = of_getintprop_default(dp, "version#", 0); 460 pbm->chip_version = of_getintprop_default(dp, "version#", 0);
460 pbm->chip_revision = of_getintprop_default(dp, "module-revision#", 0); 461 pbm->chip_revision = of_getintprop_default(dp, "module-revision#", 0);
diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c
index 41c5deb581b8..32141e1006c4 100644
--- a/arch/sparc/kernel/sbus.c
+++ b/arch/sparc/kernel/sbus.c
@@ -15,6 +15,7 @@
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/of.h> 16#include <linux/of.h>
17#include <linux/of_device.h> 17#include <linux/of_device.h>
18#include <linux/numa.h>
18 19
19#include <asm/page.h> 20#include <asm/page.h>
20#include <asm/io.h> 21#include <asm/io.h>
@@ -561,7 +562,7 @@ static void __init sbus_iommu_init(struct platform_device *op)
561 562
562 op->dev.archdata.iommu = iommu; 563 op->dev.archdata.iommu = iommu;
563 op->dev.archdata.stc = strbuf; 564 op->dev.archdata.stc = strbuf;
564 op->dev.archdata.numa_node = -1; 565 op->dev.archdata.numa_node = NUMA_NO_NODE;
565 566
566 reg_base = regs + SYSIO_IOMMUREG_BASE; 567 reg_base = regs + SYSIO_IOMMUREG_BASE;
567 iommu->iommu_control = reg_base + IOMMU_CONTROL; 568 iommu->iommu_control = reg_base + IOMMU_CONTROL;
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index b4221d3727d0..9e6bd868ba6f 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -976,13 +976,13 @@ static u64 __init memblock_nid_range_sun4u(u64 start, u64 end, int *nid)
976{ 976{
977 int prev_nid, new_nid; 977 int prev_nid, new_nid;
978 978
979 prev_nid = -1; 979 prev_nid = NUMA_NO_NODE;
980 for ( ; start < end; start += PAGE_SIZE) { 980 for ( ; start < end; start += PAGE_SIZE) {
981 for (new_nid = 0; new_nid < num_node_masks; new_nid++) { 981 for (new_nid = 0; new_nid < num_node_masks; new_nid++) {
982 struct node_mem_mask *p = &node_masks[new_nid]; 982 struct node_mem_mask *p = &node_masks[new_nid];
983 983
984 if ((start & p->mask) == p->match) { 984 if ((start & p->mask) == p->match) {
985 if (prev_nid == -1) 985 if (prev_nid == NUMA_NO_NODE)
986 prev_nid = new_nid; 986 prev_nid = new_nid;
987 break; 987 break;
988 } 988 }
@@ -1208,7 +1208,7 @@ int of_node_to_nid(struct device_node *dp)
1208 md = mdesc_grab(); 1208 md = mdesc_grab();
1209 1209
1210 count = 0; 1210 count = 0;
1211 nid = -1; 1211 nid = NUMA_NO_NODE;
1212 mdesc_for_each_node_by_name(md, grp, "group") { 1212 mdesc_for_each_node_by_name(md, grp, "group") {
1213 if (!scan_arcs_for_cfg_handle(md, grp, cfg_handle)) { 1213 if (!scan_arcs_for_cfg_handle(md, grp, cfg_handle)) {
1214 nid = count; 1214 nid = count;
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 662963681ea6..e662f987dfa2 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -7,6 +7,7 @@
7#include <linux/slab.h> 7#include <linux/slab.h>
8#include <linux/string.h> 8#include <linux/string.h>
9#include <linux/scatterlist.h> 9#include <linux/scatterlist.h>
10#include <linux/numa.h>
10#include <asm/io.h> 11#include <asm/io.h>
11#include <asm/pat.h> 12#include <asm/pat.h>
12#include <asm/x86_init.h> 13#include <asm/x86_init.h>
@@ -141,7 +142,7 @@ cpumask_of_pcibus(const struct pci_bus *bus)
141 int node; 142 int node;
142 143
143 node = __pcibus_to_node(bus); 144 node = __pcibus_to_node(bus);
144 return (node == -1) ? cpu_online_mask : 145 return (node == NUMA_NO_NODE) ? cpu_online_mask :
145 cpumask_of_node(node); 146 cpumask_of_node(node);
146} 147}
147#endif 148#endif
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index a555da094157..1e225528f0d7 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -27,6 +27,7 @@
27#include <linux/crash_dump.h> 27#include <linux/crash_dump.h>
28#include <linux/reboot.h> 28#include <linux/reboot.h>
29#include <linux/memory.h> 29#include <linux/memory.h>
30#include <linux/numa.h>
30 31
31#include <asm/uv/uv_mmrs.h> 32#include <asm/uv/uv_mmrs.h>
32#include <asm/uv/uv_hub.h> 33#include <asm/uv/uv_hub.h>
@@ -1390,7 +1391,7 @@ static void __init build_socket_tables(void)
1390 } 1391 }
1391 1392
1392 /* Set socket -> node values: */ 1393 /* Set socket -> node values: */
1393 lnid = -1; 1394 lnid = NUMA_NO_NODE;
1394 for_each_present_cpu(cpu) { 1395 for_each_present_cpu(cpu) {
1395 int nid = cpu_to_node(cpu); 1396 int nid = cpu_to_node(cpu);
1396 int apicid, sockid; 1397 int apicid, sockid;
@@ -1521,7 +1522,7 @@ static void __init uv_system_init_hub(void)
1521 new_hub->pnode = 0xffff; 1522 new_hub->pnode = 0xffff;
1522 1523
1523 new_hub->numa_blade_id = uv_node_to_blade_id(nodeid); 1524 new_hub->numa_blade_id = uv_node_to_blade_id(nodeid);
1524 new_hub->memory_nid = -1; 1525 new_hub->memory_nid = NUMA_NO_NODE;
1525 new_hub->nr_possible_cpus = 0; 1526 new_hub->nr_possible_cpus = 0;
1526 new_hub->nr_online_cpus = 0; 1527 new_hub->nr_online_cpus = 0;
1527 } 1528 }
@@ -1538,7 +1539,7 @@ static void __init uv_system_init_hub(void)
1538 1539
1539 uv_cpu_info_per(cpu)->p_uv_hub_info = uv_hub_info_list(nodeid); 1540 uv_cpu_info_per(cpu)->p_uv_hub_info = uv_hub_info_list(nodeid);
1540 uv_cpu_info_per(cpu)->blade_cpu_id = uv_cpu_hub_info(cpu)->nr_possible_cpus++; 1541 uv_cpu_info_per(cpu)->blade_cpu_id = uv_cpu_hub_info(cpu)->nr_possible_cpus++;
1541 if (uv_cpu_hub_info(cpu)->memory_nid == -1) 1542 if (uv_cpu_hub_info(cpu)->memory_nid == NUMA_NO_NODE)
1542 uv_cpu_hub_info(cpu)->memory_nid = cpu_to_node(cpu); 1543 uv_cpu_hub_info(cpu)->memory_nid = cpu_to_node(cpu);
1543 1544
1544 /* Init memoryless node: */ 1545 /* Init memoryless node: */
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index ccd1f2a8e557..c91ff9f9fe8a 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -56,6 +56,7 @@
56#include <linux/stackprotector.h> 56#include <linux/stackprotector.h>
57#include <linux/gfp.h> 57#include <linux/gfp.h>
58#include <linux/cpuidle.h> 58#include <linux/cpuidle.h>
59#include <linux/numa.h>
59 60
60#include <asm/acpi.h> 61#include <asm/acpi.h>
61#include <asm/desc.h> 62#include <asm/desc.h>
@@ -841,7 +842,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
841/* reduce the number of lines printed when booting a large cpu count system */ 842/* reduce the number of lines printed when booting a large cpu count system */
842static void announce_cpu(int cpu, int apicid) 843static void announce_cpu(int cpu, int apicid)
843{ 844{
844 static int current_node = -1; 845 static int current_node = NUMA_NO_NODE;
845 int node = early_cpu_to_node(cpu); 846 int node = early_cpu_to_node(cpu);
846 static int width, node_width; 847 static int width, node_width;
847 848
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 88e8440e75c3..2f3ee4d6af82 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -40,6 +40,7 @@
40#include <linux/export.h> 40#include <linux/export.h>
41#include <linux/debugfs.h> 41#include <linux/debugfs.h>
42#include <linux/prefetch.h> 42#include <linux/prefetch.h>
43#include <linux/numa.h>
43#include "mtip32xx.h" 44#include "mtip32xx.h"
44 45
45#define HW_CMD_SLOT_SZ (MTIP_MAX_COMMAND_SLOTS * 32) 46#define HW_CMD_SLOT_SZ (MTIP_MAX_COMMAND_SLOTS * 32)
@@ -4018,9 +4019,9 @@ static int get_least_used_cpu_on_node(int node)
4018/* Helper for selecting a node in round robin mode */ 4019/* Helper for selecting a node in round robin mode */
4019static inline int mtip_get_next_rr_node(void) 4020static inline int mtip_get_next_rr_node(void)
4020{ 4021{
4021 static int next_node = -1; 4022 static int next_node = NUMA_NO_NODE;
4022 4023
4023 if (next_node == -1) { 4024 if (next_node == NUMA_NO_NODE) {
4024 next_node = first_online_node; 4025 next_node = first_online_node;
4025 return next_node; 4026 return next_node;
4026 } 4027 }
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index f1a441ab395d..3a11b1092e80 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -63,6 +63,7 @@
63#include <linux/acpi_dma.h> 63#include <linux/acpi_dma.h>
64#include <linux/of_dma.h> 64#include <linux/of_dma.h>
65#include <linux/mempool.h> 65#include <linux/mempool.h>
66#include <linux/numa.h>
66 67
67static DEFINE_MUTEX(dma_list_mutex); 68static DEFINE_MUTEX(dma_list_mutex);
68static DEFINE_IDA(dma_ida); 69static DEFINE_IDA(dma_ida);
@@ -386,7 +387,8 @@ EXPORT_SYMBOL(dma_issue_pending_all);
386static bool dma_chan_is_local(struct dma_chan *chan, int cpu) 387static bool dma_chan_is_local(struct dma_chan *chan, int cpu)
387{ 388{
388 int node = dev_to_node(chan->device->dev); 389 int node = dev_to_node(chan->device->dev);
389 return node == -1 || cpumask_test_cpu(cpu, cpumask_of_node(node)); 390 return node == NUMA_NO_NODE ||
391 cpumask_test_cpu(cpu, cpumask_of_node(node));
390} 392}
391 393
392/** 394/**
diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c
index 2baf38cc1e23..4fe662c3bbc1 100644
--- a/drivers/infiniband/hw/hfi1/affinity.c
+++ b/drivers/infiniband/hw/hfi1/affinity.c
@@ -48,6 +48,7 @@
48#include <linux/cpumask.h> 48#include <linux/cpumask.h>
49#include <linux/module.h> 49#include <linux/module.h>
50#include <linux/interrupt.h> 50#include <linux/interrupt.h>
51#include <linux/numa.h>
51 52
52#include "hfi.h" 53#include "hfi.h"
53#include "affinity.h" 54#include "affinity.h"
@@ -777,7 +778,7 @@ void hfi1_dev_affinity_clean_up(struct hfi1_devdata *dd)
777 _dev_comp_vect_cpu_mask_clean_up(dd, entry); 778 _dev_comp_vect_cpu_mask_clean_up(dd, entry);
778unlock: 779unlock:
779 mutex_unlock(&node_affinity.lock); 780 mutex_unlock(&node_affinity.lock);
780 dd->node = -1; 781 dd->node = NUMA_NO_NODE;
781} 782}
782 783
783/* 784/*
diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
index 7835eb52e7c5..441b06e2a154 100644
--- a/drivers/infiniband/hw/hfi1/init.c
+++ b/drivers/infiniband/hw/hfi1/init.c
@@ -54,6 +54,7 @@
54#include <linux/printk.h> 54#include <linux/printk.h>
55#include <linux/hrtimer.h> 55#include <linux/hrtimer.h>
56#include <linux/bitmap.h> 56#include <linux/bitmap.h>
57#include <linux/numa.h>
57#include <rdma/rdma_vt.h> 58#include <rdma/rdma_vt.h>
58 59
59#include "hfi.h" 60#include "hfi.h"
@@ -1303,7 +1304,7 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev,
1303 dd->unit = ret; 1304 dd->unit = ret;
1304 list_add(&dd->list, &hfi1_dev_list); 1305 list_add(&dd->list, &hfi1_dev_list);
1305 } 1306 }
1306 dd->node = -1; 1307 dd->node = NUMA_NO_NODE;
1307 1308
1308 spin_unlock_irqrestore(&hfi1_devs_lock, flags); 1309 spin_unlock_irqrestore(&hfi1_devs_lock, flags);
1309 idr_preload_end(); 1310 idr_preload_end();
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 58dc70bffd5b..9c49300e9fb7 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -39,6 +39,7 @@
39#include <linux/dmi.h> 39#include <linux/dmi.h>
40#include <linux/slab.h> 40#include <linux/slab.h>
41#include <linux/iommu.h> 41#include <linux/iommu.h>
42#include <linux/numa.h>
42#include <asm/irq_remapping.h> 43#include <asm/irq_remapping.h>
43#include <asm/iommu_table.h> 44#include <asm/iommu_table.h>
44 45
@@ -477,7 +478,7 @@ static int dmar_parse_one_rhsa(struct acpi_dmar_header *header, void *arg)
477 int node = acpi_map_pxm_to_node(rhsa->proximity_domain); 478 int node = acpi_map_pxm_to_node(rhsa->proximity_domain);
478 479
479 if (!node_online(node)) 480 if (!node_online(node))
480 node = -1; 481 node = NUMA_NO_NODE;
481 drhd->iommu->node = node; 482 drhd->iommu->node = node;
482 return 0; 483 return 0;
483 } 484 }
@@ -1062,7 +1063,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
1062 iommu->msagaw = msagaw; 1063 iommu->msagaw = msagaw;
1063 iommu->segment = drhd->segment; 1064 iommu->segment = drhd->segment;
1064 1065
1065 iommu->node = -1; 1066 iommu->node = NUMA_NO_NODE;
1066 1067
1067 ver = readl(iommu->reg + DMAR_VER_REG); 1068 ver = readl(iommu->reg + DMAR_VER_REG);
1068 pr_info("%s: reg_base_addr %llx ver %d:%d cap %llx ecap %llx\n", 1069 pr_info("%s: reg_base_addr %llx ver %d:%d cap %llx ecap %llx\n",
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 78188bf7e90d..39a33dec4d0b 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -47,6 +47,7 @@
47#include <linux/dma-contiguous.h> 47#include <linux/dma-contiguous.h>
48#include <linux/dma-direct.h> 48#include <linux/dma-direct.h>
49#include <linux/crash_dump.h> 49#include <linux/crash_dump.h>
50#include <linux/numa.h>
50#include <asm/irq_remapping.h> 51#include <asm/irq_remapping.h>
51#include <asm/cacheflush.h> 52#include <asm/cacheflush.h>
52#include <asm/iommu.h> 53#include <asm/iommu.h>
@@ -1716,7 +1717,7 @@ static struct dmar_domain *alloc_domain(int flags)
1716 return NULL; 1717 return NULL;
1717 1718
1718 memset(domain, 0, sizeof(*domain)); 1719 memset(domain, 0, sizeof(*domain));
1719 domain->nid = -1; 1720 domain->nid = NUMA_NO_NODE;
1720 domain->flags = flags; 1721 domain->flags = flags;
1721 domain->has_iotlb_device = false; 1722 domain->has_iotlb_device = false;
1722 INIT_LIST_HEAD(&domain->devices); 1723 INIT_LIST_HEAD(&domain->devices);
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
index 0441abe87880..9e443df44b3b 100644
--- a/drivers/misc/sgi-xp/xpc_uv.c
+++ b/drivers/misc/sgi-xp/xpc_uv.c
@@ -22,6 +22,7 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/numa.h>
25#include <asm/uv/uv_hub.h> 26#include <asm/uv/uv_hub.h>
26#if defined CONFIG_X86_64 27#if defined CONFIG_X86_64
27#include <asm/uv/bios.h> 28#include <asm/uv/bios.h>
@@ -61,7 +62,7 @@ static struct xpc_heartbeat_uv *xpc_heartbeat_uv;
61 XPC_NOTIFY_MSG_SIZE_UV) 62 XPC_NOTIFY_MSG_SIZE_UV)
62#define XPC_NOTIFY_IRQ_NAME "xpc_notify" 63#define XPC_NOTIFY_IRQ_NAME "xpc_notify"
63 64
64static int xpc_mq_node = -1; 65static int xpc_mq_node = NUMA_NO_NODE;
65 66
66static struct xpc_gru_mq_uv *xpc_activate_mq_uv; 67static struct xpc_gru_mq_uv *xpc_activate_mq_uv;
67static struct xpc_gru_mq_uv *xpc_notify_mq_uv; 68static struct xpc_gru_mq_uv *xpc_notify_mq_uv;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index a4e7584a50cb..e100054a3765 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -27,6 +27,7 @@
27#include <linux/bpf.h> 27#include <linux/bpf.h>
28#include <linux/bpf_trace.h> 28#include <linux/bpf_trace.h>
29#include <linux/atomic.h> 29#include <linux/atomic.h>
30#include <linux/numa.h>
30#include <scsi/fc/fc_fcoe.h> 31#include <scsi/fc/fc_fcoe.h>
31#include <net/udp_tunnel.h> 32#include <net/udp_tunnel.h>
32#include <net/pkt_cls.h> 33#include <net/pkt_cls.h>
@@ -6418,7 +6419,7 @@ int ixgbe_setup_tx_resources(struct ixgbe_ring *tx_ring)
6418{ 6419{
6419 struct device *dev = tx_ring->dev; 6420 struct device *dev = tx_ring->dev;
6420 int orig_node = dev_to_node(dev); 6421 int orig_node = dev_to_node(dev);
6421 int ring_node = -1; 6422 int ring_node = NUMA_NO_NODE;
6422 int size; 6423 int size;
6423 6424
6424 size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count; 6425 size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count;
@@ -6512,7 +6513,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
6512{ 6513{
6513 struct device *dev = rx_ring->dev; 6514 struct device *dev = rx_ring->dev;
6514 int orig_node = dev_to_node(dev); 6515 int orig_node = dev_to_node(dev);
6515 int ring_node = -1; 6516 int ring_node = NUMA_NO_NODE;
6516 int size; 6517 int size;
6517 6518
6518 size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count; 6519 size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;
diff --git a/include/linux/device.h b/include/linux/device.h
index 6cb4640b6160..4d2f13e8c540 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1095,7 +1095,7 @@ static inline void set_dev_node(struct device *dev, int node)
1095#else 1095#else
1096static inline int dev_to_node(struct device *dev) 1096static inline int dev_to_node(struct device *dev)
1097{ 1097{
1098 return -1; 1098 return NUMA_NO_NODE;
1099} 1099}
1100static inline void set_dev_node(struct device *dev, int node) 1100static inline void set_dev_node(struct device *dev, int node)
1101{ 1101{
diff --git a/init/init_task.c b/init/init_task.c
index 5aebe3be4d7c..26131e73aa6d 100644
--- a/init/init_task.c
+++ b/init/init_task.c
@@ -10,6 +10,7 @@
10#include <linux/fs.h> 10#include <linux/fs.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/audit.h> 12#include <linux/audit.h>
13#include <linux/numa.h>
13 14
14#include <asm/pgtable.h> 15#include <asm/pgtable.h>
15#include <linux/uaccess.h> 16#include <linux/uaccess.h>
@@ -154,7 +155,7 @@ struct task_struct init_task
154 .vtime.state = VTIME_SYS, 155 .vtime.state = VTIME_SYS,
155#endif 156#endif
156#ifdef CONFIG_NUMA_BALANCING 157#ifdef CONFIG_NUMA_BALANCING
157 .numa_preferred_nid = -1, 158 .numa_preferred_nid = NUMA_NO_NODE,
158 .numa_group = NULL, 159 .numa_group = NULL,
159 .numa_faults = NULL, 160 .numa_faults = NULL,
160#endif 161#endif
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 087d18d771b5..ebebbcf3c5de 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -20,6 +20,7 @@
20#include <linux/freezer.h> 20#include <linux/freezer.h>
21#include <linux/ptrace.h> 21#include <linux/ptrace.h>
22#include <linux/uaccess.h> 22#include <linux/uaccess.h>
23#include <linux/numa.h>
23#include <trace/events/sched.h> 24#include <trace/events/sched.h>
24 25
25static DEFINE_SPINLOCK(kthread_create_lock); 26static DEFINE_SPINLOCK(kthread_create_lock);
@@ -675,7 +676,7 @@ __kthread_create_worker(int cpu, unsigned int flags,
675{ 676{
676 struct kthread_worker *worker; 677 struct kthread_worker *worker;
677 struct task_struct *task; 678 struct task_struct *task;
678 int node = -1; 679 int node = NUMA_NO_NODE;
679 680
680 worker = kzalloc(sizeof(*worker), GFP_KERNEL); 681 worker = kzalloc(sizeof(*worker), GFP_KERNEL);
681 if (!worker) 682 if (!worker)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 310d0637fe4b..0e6a0ef129c5 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1160,7 +1160,7 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
1160 1160
1161 /* New address space, reset the preferred nid */ 1161 /* New address space, reset the preferred nid */
1162 if (!(clone_flags & CLONE_VM)) { 1162 if (!(clone_flags & CLONE_VM)) {
1163 p->numa_preferred_nid = -1; 1163 p->numa_preferred_nid = NUMA_NO_NODE;
1164 return; 1164 return;
1165 } 1165 }
1166 1166
@@ -1180,13 +1180,13 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
1180 1180
1181static void account_numa_enqueue(struct rq *rq, struct task_struct *p) 1181static void account_numa_enqueue(struct rq *rq, struct task_struct *p)
1182{ 1182{
1183 rq->nr_numa_running += (p->numa_preferred_nid != -1); 1183 rq->nr_numa_running += (p->numa_preferred_nid != NUMA_NO_NODE);
1184 rq->nr_preferred_running += (p->numa_preferred_nid == task_node(p)); 1184 rq->nr_preferred_running += (p->numa_preferred_nid == task_node(p));
1185} 1185}
1186 1186
1187static void account_numa_dequeue(struct rq *rq, struct task_struct *p) 1187static void account_numa_dequeue(struct rq *rq, struct task_struct *p)
1188{ 1188{
1189 rq->nr_numa_running -= (p->numa_preferred_nid != -1); 1189 rq->nr_numa_running -= (p->numa_preferred_nid != NUMA_NO_NODE);
1190 rq->nr_preferred_running -= (p->numa_preferred_nid == task_node(p)); 1190 rq->nr_preferred_running -= (p->numa_preferred_nid == task_node(p));
1191} 1191}
1192 1192
@@ -1400,7 +1400,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,
1400 * two full passes of the "multi-stage node selection" test that is 1400 * two full passes of the "multi-stage node selection" test that is
1401 * executed below. 1401 * executed below.
1402 */ 1402 */
1403 if ((p->numa_preferred_nid == -1 || p->numa_scan_seq <= 4) && 1403 if ((p->numa_preferred_nid == NUMA_NO_NODE || p->numa_scan_seq <= 4) &&
1404 (cpupid_pid_unset(last_cpupid) || cpupid_match_pid(p, last_cpupid))) 1404 (cpupid_pid_unset(last_cpupid) || cpupid_match_pid(p, last_cpupid)))
1405 return true; 1405 return true;
1406 1406
@@ -1848,7 +1848,7 @@ static void numa_migrate_preferred(struct task_struct *p)
1848 unsigned long interval = HZ; 1848 unsigned long interval = HZ;
1849 1849
1850 /* This task has no NUMA fault statistics yet */ 1850 /* This task has no NUMA fault statistics yet */
1851 if (unlikely(p->numa_preferred_nid == -1 || !p->numa_faults)) 1851 if (unlikely(p->numa_preferred_nid == NUMA_NO_NODE || !p->numa_faults))
1852 return; 1852 return;
1853 1853
1854 /* Periodically retry migrating the task to the preferred node */ 1854 /* Periodically retry migrating the task to the preferred node */
@@ -2095,7 +2095,7 @@ static int preferred_group_nid(struct task_struct *p, int nid)
2095 2095
2096static void task_numa_placement(struct task_struct *p) 2096static void task_numa_placement(struct task_struct *p)
2097{ 2097{
2098 int seq, nid, max_nid = -1; 2098 int seq, nid, max_nid = NUMA_NO_NODE;
2099 unsigned long max_faults = 0; 2099 unsigned long max_faults = 0;
2100 unsigned long fault_types[2] = { 0, 0 }; 2100 unsigned long fault_types[2] = { 0, 0 };
2101 unsigned long total_faults; 2101 unsigned long total_faults;
@@ -2638,7 +2638,8 @@ static void update_scan_period(struct task_struct *p, int new_cpu)
2638 * the preferred node. 2638 * the preferred node.
2639 */ 2639 */
2640 if (dst_nid == p->numa_preferred_nid || 2640 if (dst_nid == p->numa_preferred_nid ||
2641 (p->numa_preferred_nid != -1 && src_nid != p->numa_preferred_nid)) 2641 (p->numa_preferred_nid != NUMA_NO_NODE &&
2642 src_nid != p->numa_preferred_nid))
2642 return; 2643 return;
2643 } 2644 }
2644 2645
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 8d666ab84b5c..087a3e9a0202 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -5,6 +5,7 @@
5#include <linux/cpumask.h> 5#include <linux/cpumask.h>
6#include <linux/export.h> 6#include <linux/export.h>
7#include <linux/memblock.h> 7#include <linux/memblock.h>
8#include <linux/numa.h>
8 9
9/** 10/**
10 * cpumask_next - get the next cpu in a cpumask 11 * cpumask_next - get the next cpu in a cpumask
@@ -206,7 +207,7 @@ unsigned int cpumask_local_spread(unsigned int i, int node)
206 /* Wrap: we always want a cpu. */ 207 /* Wrap: we always want a cpu. */
207 i %= num_online_cpus(); 208 i %= num_online_cpus();
208 209
209 if (node == -1) { 210 if (node == NUMA_NO_NODE) {
210 for_each_cpu(cpu, cpu_online_mask) 211 for_each_cpu(cpu, cpu_online_mask)
211 if (i-- == 0) 212 if (i-- == 0)
212 return cpu; 213 return cpu;
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index faf357eaf0ce..d066f7ca1ee8 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -33,6 +33,7 @@
33#include <linux/page_idle.h> 33#include <linux/page_idle.h>
34#include <linux/shmem_fs.h> 34#include <linux/shmem_fs.h>
35#include <linux/oom.h> 35#include <linux/oom.h>
36#include <linux/numa.h>
36 37
37#include <asm/tlb.h> 38#include <asm/tlb.h>
38#include <asm/pgalloc.h> 39#include <asm/pgalloc.h>
@@ -1475,7 +1476,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
1475 struct anon_vma *anon_vma = NULL; 1476 struct anon_vma *anon_vma = NULL;
1476 struct page *page; 1477 struct page *page;
1477 unsigned long haddr = vmf->address & HPAGE_PMD_MASK; 1478 unsigned long haddr = vmf->address & HPAGE_PMD_MASK;
1478 int page_nid = -1, this_nid = numa_node_id(); 1479 int page_nid = NUMA_NO_NODE, this_nid = numa_node_id();
1479 int target_nid, last_cpupid = -1; 1480 int target_nid, last_cpupid = -1;
1480 bool page_locked; 1481 bool page_locked;
1481 bool migrated = false; 1482 bool migrated = false;
@@ -1520,7 +1521,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
1520 */ 1521 */
1521 page_locked = trylock_page(page); 1522 page_locked = trylock_page(page);
1522 target_nid = mpol_misplaced(page, vma, haddr); 1523 target_nid = mpol_misplaced(page, vma, haddr);
1523 if (target_nid == -1) { 1524 if (target_nid == NUMA_NO_NODE) {
1524 /* If the page was locked, there are no parallel migrations */ 1525 /* If the page was locked, there are no parallel migrations */
1525 if (page_locked) 1526 if (page_locked)
1526 goto clear_pmdnuma; 1527 goto clear_pmdnuma;
@@ -1528,7 +1529,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
1528 1529
1529 /* Migration could have started since the pmd_trans_migrating check */ 1530 /* Migration could have started since the pmd_trans_migrating check */
1530 if (!page_locked) { 1531 if (!page_locked) {
1531 page_nid = -1; 1532 page_nid = NUMA_NO_NODE;
1532 if (!get_page_unless_zero(page)) 1533 if (!get_page_unless_zero(page))
1533 goto out_unlock; 1534 goto out_unlock;
1534 spin_unlock(vmf->ptl); 1535 spin_unlock(vmf->ptl);
@@ -1549,14 +1550,14 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
1549 if (unlikely(!pmd_same(pmd, *vmf->pmd))) { 1550 if (unlikely(!pmd_same(pmd, *vmf->pmd))) {
1550 unlock_page(page); 1551 unlock_page(page);
1551 put_page(page); 1552 put_page(page);
1552 page_nid = -1; 1553 page_nid = NUMA_NO_NODE;
1553 goto out_unlock; 1554 goto out_unlock;
1554 } 1555 }
1555 1556
1556 /* Bail if we fail to protect against THP splits for any reason */ 1557 /* Bail if we fail to protect against THP splits for any reason */
1557 if (unlikely(!anon_vma)) { 1558 if (unlikely(!anon_vma)) {
1558 put_page(page); 1559 put_page(page);
1559 page_nid = -1; 1560 page_nid = NUMA_NO_NODE;
1560 goto clear_pmdnuma; 1561 goto clear_pmdnuma;
1561 } 1562 }
1562 1563
@@ -1618,7 +1619,7 @@ out:
1618 if (anon_vma) 1619 if (anon_vma)
1619 page_unlock_anon_vma_read(anon_vma); 1620 page_unlock_anon_vma_read(anon_vma);
1620 1621
1621 if (page_nid != -1) 1622 if (page_nid != NUMA_NO_NODE)
1622 task_numa_fault(last_cpupid, page_nid, HPAGE_PMD_NR, 1623 task_numa_fault(last_cpupid, page_nid, HPAGE_PMD_NR,
1623 flags); 1624 flags);
1624 1625
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 8dfdffc34a99..3c504fa6b460 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -25,6 +25,7 @@
25#include <linux/swap.h> 25#include <linux/swap.h>
26#include <linux/swapops.h> 26#include <linux/swapops.h>
27#include <linux/jhash.h> 27#include <linux/jhash.h>
28#include <linux/numa.h>
28 29
29#include <asm/page.h> 30#include <asm/page.h>
30#include <asm/pgtable.h> 31#include <asm/pgtable.h>
@@ -887,7 +888,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
887 struct zonelist *zonelist; 888 struct zonelist *zonelist;
888 struct zone *zone; 889 struct zone *zone;
889 struct zoneref *z; 890 struct zoneref *z;
890 int node = -1; 891 int node = NUMA_NO_NODE;
891 892
892 zonelist = node_zonelist(nid, gfp_mask); 893 zonelist = node_zonelist(nid, gfp_mask);
893 894
diff --git a/mm/ksm.c b/mm/ksm.c
index 6c48ad13b4c9..fd2db6a74d3c 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -598,7 +598,7 @@ static struct stable_node *alloc_stable_node_chain(struct stable_node *dup,
598 chain->chain_prune_time = jiffies; 598 chain->chain_prune_time = jiffies;
599 chain->rmap_hlist_len = STABLE_NODE_CHAIN; 599 chain->rmap_hlist_len = STABLE_NODE_CHAIN;
600#if defined (CONFIG_DEBUG_VM) && defined(CONFIG_NUMA) 600#if defined (CONFIG_DEBUG_VM) && defined(CONFIG_NUMA)
601 chain->nid = -1; /* debug */ 601 chain->nid = NUMA_NO_NODE; /* debug */
602#endif 602#endif
603 ksm_stable_node_chains++; 603 ksm_stable_node_chains++;
604 604
diff --git a/mm/memory.c b/mm/memory.c
index e11ca9dd823f..eb40f32295d2 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -69,6 +69,7 @@
69#include <linux/userfaultfd_k.h> 69#include <linux/userfaultfd_k.h>
70#include <linux/dax.h> 70#include <linux/dax.h>
71#include <linux/oom.h> 71#include <linux/oom.h>
72#include <linux/numa.h>
72 73
73#include <asm/io.h> 74#include <asm/io.h>
74#include <asm/mmu_context.h> 75#include <asm/mmu_context.h>
@@ -3586,7 +3587,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
3586{ 3587{
3587 struct vm_area_struct *vma = vmf->vma; 3588 struct vm_area_struct *vma = vmf->vma;
3588 struct page *page = NULL; 3589 struct page *page = NULL;
3589 int page_nid = -1; 3590 int page_nid = NUMA_NO_NODE;
3590 int last_cpupid; 3591 int last_cpupid;
3591 int target_nid; 3592 int target_nid;
3592 bool migrated = false; 3593 bool migrated = false;
@@ -3653,7 +3654,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
3653 target_nid = numa_migrate_prep(page, vma, vmf->address, page_nid, 3654 target_nid = numa_migrate_prep(page, vma, vmf->address, page_nid,
3654 &flags); 3655 &flags);
3655 pte_unmap_unlock(vmf->pte, vmf->ptl); 3656 pte_unmap_unlock(vmf->pte, vmf->ptl);
3656 if (target_nid == -1) { 3657 if (target_nid == NUMA_NO_NODE) {
3657 put_page(page); 3658 put_page(page);
3658 goto out; 3659 goto out;
3659 } 3660 }
@@ -3667,7 +3668,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
3667 flags |= TNF_MIGRATE_FAIL; 3668 flags |= TNF_MIGRATE_FAIL;
3668 3669
3669out: 3670out:
3670 if (page_nid != -1) 3671 if (page_nid != NUMA_NO_NODE)
3671 task_numa_fault(last_cpupid, page_nid, 1, flags); 3672 task_numa_fault(last_cpupid, page_nid, 1, flags);
3672 return 0; 3673 return 0;
3673} 3674}
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 4f07c8ddfdd7..b3d3c64d15df 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -702,9 +702,9 @@ static void node_states_check_changes_online(unsigned long nr_pages,
702{ 702{
703 int nid = zone_to_nid(zone); 703 int nid = zone_to_nid(zone);
704 704
705 arg->status_change_nid = -1; 705 arg->status_change_nid = NUMA_NO_NODE;
706 arg->status_change_nid_normal = -1; 706 arg->status_change_nid_normal = NUMA_NO_NODE;
707 arg->status_change_nid_high = -1; 707 arg->status_change_nid_high = NUMA_NO_NODE;
708 708
709 if (!node_state(nid, N_MEMORY)) 709 if (!node_state(nid, N_MEMORY))
710 arg->status_change_nid = nid; 710 arg->status_change_nid = nid;
@@ -1509,9 +1509,9 @@ static void node_states_check_changes_offline(unsigned long nr_pages,
1509 unsigned long present_pages = 0; 1509 unsigned long present_pages = 0;
1510 enum zone_type zt; 1510 enum zone_type zt;
1511 1511
1512 arg->status_change_nid = -1; 1512 arg->status_change_nid = NUMA_NO_NODE;
1513 arg->status_change_nid_normal = -1; 1513 arg->status_change_nid_normal = NUMA_NO_NODE;
1514 arg->status_change_nid_high = -1; 1514 arg->status_change_nid_high = NUMA_NO_NODE;
1515 1515
1516 /* 1516 /*
1517 * Check whether node_states[N_NORMAL_MEMORY] will be changed. 1517 * Check whether node_states[N_NORMAL_MEMORY] will be changed.
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index ee2bce59d2bf..76e7e4bc3335 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2304,7 +2304,7 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
2304 unsigned long pgoff; 2304 unsigned long pgoff;
2305 int thiscpu = raw_smp_processor_id(); 2305 int thiscpu = raw_smp_processor_id();
2306 int thisnid = cpu_to_node(thiscpu); 2306 int thisnid = cpu_to_node(thiscpu);
2307 int polnid = -1; 2307 int polnid = NUMA_NO_NODE;
2308 int ret = -1; 2308 int ret = -1;
2309 2309
2310 pol = get_vma_policy(vma, addr); 2310 pol = get_vma_policy(vma, addr);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5361bd078493..1f9f1409df9b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6016,7 +6016,7 @@ int __meminit __early_pfn_to_nid(unsigned long pfn,
6016 return state->last_nid; 6016 return state->last_nid;
6017 6017
6018 nid = memblock_search_pfn_nid(pfn, &start_pfn, &end_pfn); 6018 nid = memblock_search_pfn_nid(pfn, &start_pfn, &end_pfn);
6019 if (nid != -1) { 6019 if (nid != NUMA_NO_NODE) {
6020 state->last_start = start_pfn; 6020 state->last_start = start_pfn;
6021 state->last_end = end_pfn; 6021 state->last_end = end_pfn;
6022 state->last_nid = nid; 6022 state->last_nid = nid;
@@ -6771,7 +6771,7 @@ unsigned long __init node_map_pfn_alignment(void)
6771{ 6771{
6772 unsigned long accl_mask = 0, last_end = 0; 6772 unsigned long accl_mask = 0, last_end = 0;
6773 unsigned long start, end, mask; 6773 unsigned long start, end, mask;
6774 int last_nid = -1; 6774 int last_nid = NUMA_NO_NODE;
6775 int i, nid; 6775 int i, nid;
6776 6776
6777 for_each_mem_pfn_range(i, MAX_NUMNODES, &start, &end, &nid) { 6777 for_each_mem_pfn_range(i, MAX_NUMNODES, &start, &end, &nid) {
diff --git a/mm/page_ext.c b/mm/page_ext.c
index 8c78b8d45117..762d5b7eb523 100644
--- a/mm/page_ext.c
+++ b/mm/page_ext.c
@@ -300,7 +300,7 @@ static int __meminit online_page_ext(unsigned long start_pfn,
300 start = SECTION_ALIGN_DOWN(start_pfn); 300 start = SECTION_ALIGN_DOWN(start_pfn);
301 end = SECTION_ALIGN_UP(start_pfn + nr_pages); 301 end = SECTION_ALIGN_UP(start_pfn + nr_pages);
302 302
303 if (nid == -1) { 303 if (nid == NUMA_NO_NODE) {
304 /* 304 /*
305 * In this case, "nid" already exists and contains valid memory. 305 * In this case, "nid" already exists and contains valid memory.
306 * "start_pfn" passed to us is a pfn which is an arg for 306 * "start_pfn" passed to us is a pfn which is an arg for
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 6ac919847ce6..f3f5a78cd062 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -158,6 +158,7 @@
158#include <linux/etherdevice.h> 158#include <linux/etherdevice.h>
159#include <linux/kthread.h> 159#include <linux/kthread.h>
160#include <linux/prefetch.h> 160#include <linux/prefetch.h>
161#include <linux/mmzone.h>
161#include <net/net_namespace.h> 162#include <net/net_namespace.h>
162#include <net/checksum.h> 163#include <net/checksum.h>
163#include <net/ipv6.h> 164#include <net/ipv6.h>
@@ -3625,7 +3626,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
3625 pkt_dev->svlan_cfi = 0; 3626 pkt_dev->svlan_cfi = 0;
3626 pkt_dev->svlan_id = 0xffff; 3627 pkt_dev->svlan_id = 0xffff;
3627 pkt_dev->burst = 1; 3628 pkt_dev->burst = 1;
3628 pkt_dev->node = -1; 3629 pkt_dev->node = NUMA_NO_NODE;
3629 3630
3630 err = pktgen_setup_dev(t->net, pkt_dev, ifname); 3631 err = pktgen_setup_dev(t->net, pkt_dev, ifname);
3631 if (err) 3632 if (err)
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 86e1e37eb4e8..b37e6e0a1026 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -15,6 +15,7 @@
15#include <linux/netlink.h> 15#include <linux/netlink.h>
16#include <linux/qrtr.h> 16#include <linux/qrtr.h>
17#include <linux/termios.h> /* For TIOCINQ/OUTQ */ 17#include <linux/termios.h> /* For TIOCINQ/OUTQ */
18#include <linux/numa.h>
18 19
19#include <net/sock.h> 20#include <net/sock.h>
20 21
@@ -101,7 +102,7 @@ static inline struct qrtr_sock *qrtr_sk(struct sock *sk)
101 return container_of(sk, struct qrtr_sock, sk); 102 return container_of(sk, struct qrtr_sock, sk);
102} 103}
103 104
104static unsigned int qrtr_local_nid = -1; 105static unsigned int qrtr_local_nid = NUMA_NO_NODE;
105 106
106/* for node ids */ 107/* for node ids */
107static RADIX_TREE(qrtr_nodes, GFP_KERNEL); 108static RADIX_TREE(qrtr_nodes, GFP_KERNEL);