numa.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  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
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #include <linux/threads.h>
  12. #include <linux/bootmem.h>
  13. #include <linux/init.h>
  14. #include <linux/mm.h>
  15. #include <linux/mmzone.h>
  16. #include <linux/module.h>
  17. #include <linux/nodemask.h>
  18. #include <linux/cpu.h>
  19. #include <linux/notifier.h>
  20. #include <asm/sparsemem.h>
  21. #include <asm/lmb.h>
  22. #include <asm/system.h>
  23. #include <asm/smp.h>
  24. static int numa_enabled = 1;
  25. static int numa_debug;
  26. #define dbg(args...) if (numa_debug) { printk(KERN_INFO args); }
  27. int numa_cpu_lookup_table[NR_CPUS];
  28. cpumask_t numa_cpumask_lookup_table[MAX_NUMNODES];
  29. struct pglist_data *node_data[MAX_NUMNODES];
  30. EXPORT_SYMBOL(numa_cpu_lookup_table);
  31. EXPORT_SYMBOL(numa_cpumask_lookup_table);
  32. EXPORT_SYMBOL(node_data);
  33. static bootmem_data_t __initdata plat_node_bdata[MAX_NUMNODES];
  34. static int min_common_depth;
  35. static int n_mem_addr_cells, n_mem_size_cells;
  36. static void __cpuinit map_cpu_to_node(int cpu, int node)
  37. {
  38. numa_cpu_lookup_table[cpu] = node;
  39. dbg("adding cpu %d to node %d\n", cpu, node);
  40. if (!(cpu_isset(cpu, numa_cpumask_lookup_table[node])))
  41. cpu_set(cpu, numa_cpumask_lookup_table[node]);
  42. }
  43. #ifdef CONFIG_HOTPLUG_CPU
  44. static void unmap_cpu_from_node(unsigned long cpu)
  45. {
  46. int node = numa_cpu_lookup_table[cpu];
  47. dbg("removing cpu %lu from node %d\n", cpu, node);
  48. if (cpu_isset(cpu, numa_cpumask_lookup_table[node])) {
  49. cpu_clear(cpu, numa_cpumask_lookup_table[node]);
  50. } else {
  51. printk(KERN_ERR "WARNING: cpu %lu not found in node %d\n",
  52. cpu, node);
  53. }
  54. }
  55. #endif /* CONFIG_HOTPLUG_CPU */
  56. static struct device_node * __cpuinit find_cpu_node(unsigned int cpu)
  57. {
  58. unsigned int hw_cpuid = get_hard_smp_processor_id(cpu);
  59. struct device_node *cpu_node = NULL;
  60. const unsigned int *interrupt_server, *reg;
  61. int len;
  62. while ((cpu_node = of_find_node_by_type(cpu_node, "cpu")) != NULL) {
  63. /* Try interrupt server first */
  64. interrupt_server = get_property(cpu_node,
  65. "ibm,ppc-interrupt-server#s", &len);
  66. len = len / sizeof(u32);
  67. if (interrupt_server && (len > 0)) {
  68. while (len--) {
  69. if (interrupt_server[len] == hw_cpuid)
  70. return cpu_node;
  71. }
  72. } else {
  73. reg = get_property(cpu_node, "reg", &len);
  74. if (reg && (len > 0) && (reg[0] == hw_cpuid))
  75. return cpu_node;
  76. }
  77. }
  78. return NULL;
  79. }
  80. /* must hold reference to node during call */
  81. static const int *of_get_associativity(struct device_node *dev)
  82. {
  83. return get_property(dev, "ibm,associativity", NULL);
  84. }
  85. /* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa
  86. * info is found.
  87. */
  88. static int of_node_to_nid_single(struct device_node *device)
  89. {
  90. int nid = -1;
  91. const unsigned int *tmp;
  92. if (min_common_depth == -1)
  93. goto out;
  94. tmp = of_get_associativity(device);
  95. if (!tmp)
  96. goto out;
  97. if (tmp[0] >= min_common_depth)
  98. nid = tmp[min_common_depth];
  99. /* POWER4 LPAR uses 0xffff as invalid node */
  100. if (nid == 0xffff || nid >= MAX_NUMNODES)
  101. nid = -1;
  102. out:
  103. return nid;
  104. }
  105. /* Walk the device tree upwards, looking for an associativity id */
  106. int of_node_to_nid(struct device_node *device)
  107. {
  108. struct device_node *tmp;
  109. int nid = -1;
  110. of_node_get(device);
  111. while (device) {
  112. nid = of_node_to_nid_single(device);
  113. if (nid != -1)
  114. break;
  115. tmp = device;
  116. device = of_get_parent(tmp);
  117. of_node_put(tmp);
  118. }
  119. of_node_put(device);
  120. return nid;
  121. }
  122. EXPORT_SYMBOL_GPL(of_node_to_nid);
  123. /*
  124. * In theory, the "ibm,associativity" property may contain multiple
  125. * associativity lists because a resource may be multiply connected
  126. * into the machine. This resource then has different associativity
  127. * characteristics relative to its multiple connections. We ignore
  128. * this for now. We also assume that all cpu and memory sets have
  129. * their distances represented at a common level. This won't be
  130. * true for heirarchical NUMA.
  131. *
  132. * In any case the ibm,associativity-reference-points should give
  133. * the correct depth for a normal NUMA system.
  134. *
  135. * - Dave Hansen <haveblue@us.ibm.com>
  136. */
  137. static int __init find_min_common_depth(void)
  138. {
  139. int depth;
  140. const unsigned int *ref_points;
  141. struct device_node *rtas_root;
  142. unsigned int len;
  143. rtas_root = of_find_node_by_path("/rtas");
  144. if (!rtas_root)
  145. return -1;
  146. /*
  147. * this property is 2 32-bit integers, each representing a level of
  148. * depth in the associativity nodes. The first is for an SMP
  149. * configuration (should be all 0's) and the second is for a normal
  150. * NUMA configuration.
  151. */
  152. ref_points = get_property(rtas_root,
  153. "ibm,associativity-reference-points", &len);
  154. if ((len >= 1) && ref_points) {
  155. depth = ref_points[1];
  156. } else {
  157. dbg("NUMA: ibm,associativity-reference-points not found.\n");
  158. depth = -1;
  159. }
  160. of_node_put(rtas_root);
  161. return depth;
  162. }
  163. static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells)
  164. {
  165. struct device_node *memory = NULL;
  166. memory = of_find_node_by_type(memory, "memory");
  167. if (!memory)
  168. panic("numa.c: No memory nodes found!");
  169. *n_addr_cells = prom_n_addr_cells(memory);
  170. *n_size_cells = prom_n_size_cells(memory);
  171. of_node_put(memory);
  172. }
  173. static unsigned long __devinit read_n_cells(int n, const unsigned int **buf)
  174. {
  175. unsigned long result = 0;
  176. while (n--) {
  177. result = (result << 32) | **buf;
  178. (*buf)++;
  179. }
  180. return result;
  181. }
  182. /*
  183. * Figure out to which domain a cpu belongs and stick it there.
  184. * Return the id of the domain used.
  185. */
  186. static int __cpuinit numa_setup_cpu(unsigned long lcpu)
  187. {
  188. int nid = 0;
  189. struct device_node *cpu = find_cpu_node(lcpu);
  190. if (!cpu) {
  191. WARN_ON(1);
  192. goto out;
  193. }
  194. nid = of_node_to_nid_single(cpu);
  195. if (nid < 0 || !node_online(nid))
  196. nid = any_online_node(NODE_MASK_ALL);
  197. out:
  198. map_cpu_to_node(lcpu, nid);
  199. of_node_put(cpu);
  200. return nid;
  201. }
  202. static int __cpuinit cpu_numa_callback(struct notifier_block *nfb,
  203. unsigned long action,
  204. void *hcpu)
  205. {
  206. unsigned long lcpu = (unsigned long)hcpu;
  207. int ret = NOTIFY_DONE;
  208. switch (action) {
  209. case CPU_UP_PREPARE:
  210. numa_setup_cpu(lcpu);
  211. ret = NOTIFY_OK;
  212. break;
  213. #ifdef CONFIG_HOTPLUG_CPU
  214. case CPU_DEAD:
  215. case CPU_UP_CANCELED:
  216. unmap_cpu_from_node(lcpu);
  217. break;
  218. ret = NOTIFY_OK;
  219. #endif
  220. }
  221. return ret;
  222. }
  223. /*
  224. * Check and possibly modify a memory region to enforce the memory limit.
  225. *
  226. * Returns the size the region should have to enforce the memory limit.
  227. * This will either be the original value of size, a truncated value,
  228. * or zero. If the returned value of size is 0 the region should be
  229. * discarded as it lies wholy above the memory limit.
  230. */
  231. static unsigned long __init numa_enforce_memory_limit(unsigned long start,
  232. unsigned long size)
  233. {
  234. /*
  235. * We use lmb_end_of_DRAM() in here instead of memory_limit because
  236. * we've already adjusted it for the limit and it takes care of
  237. * having memory holes below the limit.
  238. */
  239. if (! memory_limit)
  240. return size;
  241. if (start + size <= lmb_end_of_DRAM())
  242. return size;
  243. if (start >= lmb_end_of_DRAM())
  244. return 0;
  245. return lmb_end_of_DRAM() - start;
  246. }
  247. static int __init parse_numa_properties(void)
  248. {
  249. struct device_node *cpu = NULL;
  250. struct device_node *memory = NULL;
  251. int default_nid = 0;
  252. unsigned long i;
  253. if (numa_enabled == 0) {
  254. printk(KERN_WARNING "NUMA disabled by user\n");
  255. return -1;
  256. }
  257. min_common_depth = find_min_common_depth();
  258. if (min_common_depth < 0)
  259. return min_common_depth;
  260. dbg("NUMA associativity depth for CPU/Memory: %d\n", min_common_depth);
  261. /*
  262. * Even though we connect cpus to numa domains later in SMP
  263. * init, we need to know the node ids now. This is because
  264. * each node to be onlined must have NODE_DATA etc backing it.
  265. */
  266. for_each_present_cpu(i) {
  267. int nid;
  268. cpu = find_cpu_node(i);
  269. BUG_ON(!cpu);
  270. nid = of_node_to_nid_single(cpu);
  271. of_node_put(cpu);
  272. /*
  273. * Don't fall back to default_nid yet -- we will plug
  274. * cpus into nodes once the memory scan has discovered
  275. * the topology.
  276. */
  277. if (nid < 0)
  278. continue;
  279. node_set_online(nid);
  280. }
  281. get_n_mem_cells(&n_mem_addr_cells, &n_mem_size_cells);
  282. memory = NULL;
  283. while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
  284. unsigned long start;
  285. unsigned long size;
  286. int nid;
  287. int ranges;
  288. const unsigned int *memcell_buf;
  289. unsigned int len;
  290. memcell_buf = get_property(memory,
  291. "linux,usable-memory", &len);
  292. if (!memcell_buf || len <= 0)
  293. memcell_buf = get_property(memory, "reg", &len);
  294. if (!memcell_buf || len <= 0)
  295. continue;
  296. /* ranges in cell */
  297. ranges = (len >> 2) / (n_mem_addr_cells + n_mem_size_cells);
  298. new_range:
  299. /* these are order-sensitive, and modify the buffer pointer */
  300. start = read_n_cells(n_mem_addr_cells, &memcell_buf);
  301. size = read_n_cells(n_mem_size_cells, &memcell_buf);
  302. /*
  303. * Assumption: either all memory nodes or none will
  304. * have associativity properties. If none, then
  305. * everything goes to default_nid.
  306. */
  307. nid = of_node_to_nid_single(memory);
  308. if (nid < 0)
  309. nid = default_nid;
  310. node_set_online(nid);
  311. if (!(size = numa_enforce_memory_limit(start, size))) {
  312. if (--ranges)
  313. goto new_range;
  314. else
  315. continue;
  316. }
  317. add_active_range(nid, start >> PAGE_SHIFT,
  318. (start >> PAGE_SHIFT) + (size >> PAGE_SHIFT));
  319. if (--ranges)
  320. goto new_range;
  321. }
  322. return 0;
  323. }
  324. static void __init setup_nonnuma(void)
  325. {
  326. unsigned long top_of_ram = lmb_end_of_DRAM();
  327. unsigned long total_ram = lmb_phys_mem_size();
  328. unsigned long start_pfn, end_pfn;
  329. unsigned int i;
  330. printk(KERN_DEBUG "Top of RAM: 0x%lx, Total RAM: 0x%lx\n",
  331. top_of_ram, total_ram);
  332. printk(KERN_DEBUG "Memory hole size: %ldMB\n",
  333. (top_of_ram - total_ram) >> 20);
  334. for (i = 0; i < lmb.memory.cnt; ++i) {
  335. start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT;
  336. end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i);
  337. add_active_range(0, start_pfn, end_pfn);
  338. }
  339. node_set_online(0);
  340. }
  341. void __init dump_numa_cpu_topology(void)
  342. {
  343. unsigned int node;
  344. unsigned int cpu, count;
  345. if (min_common_depth == -1 || !numa_enabled)
  346. return;
  347. for_each_online_node(node) {
  348. printk(KERN_DEBUG "Node %d CPUs:", node);
  349. count = 0;
  350. /*
  351. * If we used a CPU iterator here we would miss printing
  352. * the holes in the cpumap.
  353. */
  354. for (cpu = 0; cpu < NR_CPUS; cpu++) {
  355. if (cpu_isset(cpu, numa_cpumask_lookup_table[node])) {
  356. if (count == 0)
  357. printk(" %u", cpu);
  358. ++count;
  359. } else {
  360. if (count > 1)
  361. printk("-%u", cpu - 1);
  362. count = 0;
  363. }
  364. }
  365. if (count > 1)
  366. printk("-%u", NR_CPUS - 1);
  367. printk("\n");
  368. }
  369. }
  370. static void __init dump_numa_memory_topology(void)
  371. {
  372. unsigned int node;
  373. unsigned int count;
  374. if (min_common_depth == -1 || !numa_enabled)
  375. return;
  376. for_each_online_node(node) {
  377. unsigned long i;
  378. printk(KERN_DEBUG "Node %d Memory:", node);
  379. count = 0;
  380. for (i = 0; i < lmb_end_of_DRAM();
  381. i += (1 << SECTION_SIZE_BITS)) {
  382. if (early_pfn_to_nid(i >> PAGE_SHIFT) == node) {
  383. if (count == 0)
  384. printk(" 0x%lx", i);
  385. ++count;
  386. } else {
  387. if (count > 0)
  388. printk("-0x%lx", i);
  389. count = 0;
  390. }
  391. }
  392. if (count > 0)
  393. printk("-0x%lx", i);
  394. printk("\n");
  395. }
  396. }
  397. /*
  398. * Allocate some memory, satisfying the lmb or bootmem allocator where
  399. * required. nid is the preferred node and end is the physical address of
  400. * the highest address in the node.
  401. *
  402. * Returns the physical address of the memory.
  403. */
  404. static void __init *careful_allocation(int nid, unsigned long size,
  405. unsigned long align,
  406. unsigned long end_pfn)
  407. {
  408. int new_nid;
  409. unsigned long ret = __lmb_alloc_base(size, align, end_pfn << PAGE_SHIFT);
  410. /* retry over all memory */
  411. if (!ret)
  412. ret = __lmb_alloc_base(size, align, lmb_end_of_DRAM());
  413. if (!ret)
  414. panic("numa.c: cannot allocate %lu bytes on node %d",
  415. size, nid);
  416. /*
  417. * If the memory came from a previously allocated node, we must
  418. * retry with the bootmem allocator.
  419. */
  420. new_nid = early_pfn_to_nid(ret >> PAGE_SHIFT);
  421. if (new_nid < nid) {
  422. ret = (unsigned long)__alloc_bootmem_node(NODE_DATA(new_nid),
  423. size, align, 0);
  424. if (!ret)
  425. panic("numa.c: cannot allocate %lu bytes on node %d",
  426. size, new_nid);
  427. ret = __pa(ret);
  428. dbg("alloc_bootmem %lx %lx\n", ret, size);
  429. }
  430. return (void *)ret;
  431. }
  432. static struct notifier_block __cpuinitdata ppc64_numa_nb = {
  433. .notifier_call = cpu_numa_callback,
  434. .priority = 1 /* Must run before sched domains notifier. */
  435. };
  436. void __init do_init_bootmem(void)
  437. {
  438. int nid;
  439. unsigned int i;
  440. min_low_pfn = 0;
  441. max_low_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT;
  442. max_pfn = max_low_pfn;
  443. if (parse_numa_properties())
  444. setup_nonnuma();
  445. else
  446. dump_numa_memory_topology();
  447. register_cpu_notifier(&ppc64_numa_nb);
  448. cpu_numa_callback(&ppc64_numa_nb, CPU_UP_PREPARE,
  449. (void *)(unsigned long)boot_cpuid);
  450. for_each_online_node(nid) {
  451. unsigned long start_pfn, end_pfn;
  452. unsigned long bootmem_paddr;
  453. unsigned long bootmap_pages;
  454. get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
  455. /* Allocate the node structure node local if possible */
  456. NODE_DATA(nid) = careful_allocation(nid,
  457. sizeof(struct pglist_data),
  458. SMP_CACHE_BYTES, end_pfn);
  459. NODE_DATA(nid) = __va(NODE_DATA(nid));
  460. memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
  461. dbg("node %d\n", nid);
  462. dbg("NODE_DATA() = %p\n", NODE_DATA(nid));
  463. NODE_DATA(nid)->bdata = &plat_node_bdata[nid];
  464. NODE_DATA(nid)->node_start_pfn = start_pfn;
  465. NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn;
  466. if (NODE_DATA(nid)->node_spanned_pages == 0)
  467. continue;
  468. dbg("start_paddr = %lx\n", start_pfn << PAGE_SHIFT);
  469. dbg("end_paddr = %lx\n", end_pfn << PAGE_SHIFT);
  470. bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
  471. bootmem_paddr = (unsigned long)careful_allocation(nid,
  472. bootmap_pages << PAGE_SHIFT,
  473. PAGE_SIZE, end_pfn);
  474. memset(__va(bootmem_paddr), 0, bootmap_pages << PAGE_SHIFT);
  475. dbg("bootmap_paddr = %lx\n", bootmem_paddr);
  476. init_bootmem_node(NODE_DATA(nid), bootmem_paddr >> PAGE_SHIFT,
  477. start_pfn, end_pfn);
  478. free_bootmem_with_active_regions(nid, end_pfn);
  479. /* Mark reserved regions on this node */
  480. for (i = 0; i < lmb.reserved.cnt; i++) {
  481. unsigned long physbase = lmb.reserved.region[i].base;
  482. unsigned long size = lmb.reserved.region[i].size;
  483. unsigned long start_paddr = start_pfn << PAGE_SHIFT;
  484. unsigned long end_paddr = end_pfn << PAGE_SHIFT;
  485. if (early_pfn_to_nid(physbase >> PAGE_SHIFT) != nid &&
  486. early_pfn_to_nid((physbase+size-1) >> PAGE_SHIFT) != nid)
  487. continue;
  488. if (physbase < end_paddr &&
  489. (physbase+size) > start_paddr) {
  490. /* overlaps */
  491. if (physbase < start_paddr) {
  492. size -= start_paddr - physbase;
  493. physbase = start_paddr;
  494. }
  495. if (size > end_paddr - physbase)
  496. size = end_paddr - physbase;
  497. dbg("reserve_bootmem %lx %lx\n", physbase,
  498. size);
  499. reserve_bootmem_node(NODE_DATA(nid), physbase,
  500. size);
  501. }
  502. }
  503. sparse_memory_present_with_active_regions(nid);
  504. }
  505. }
  506. void __init paging_init(void)
  507. {
  508. unsigned long max_zone_pfns[MAX_NR_ZONES];
  509. memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
  510. max_zone_pfns[ZONE_DMA] = lmb_end_of_DRAM() >> PAGE_SHIFT;
  511. free_area_init_nodes(max_zone_pfns);
  512. }
  513. static int __init early_numa(char *p)
  514. {
  515. if (!p)
  516. return 0;
  517. if (strstr(p, "off"))
  518. numa_enabled = 0;
  519. if (strstr(p, "debug"))
  520. numa_debug = 1;
  521. return 0;
  522. }
  523. early_param("numa", early_numa);
  524. #ifdef CONFIG_MEMORY_HOTPLUG
  525. /*
  526. * Find the node associated with a hot added memory section. Section
  527. * corresponds to a SPARSEMEM section, not an LMB. It is assumed that
  528. * sections are fully contained within a single LMB.
  529. */
  530. int hot_add_scn_to_nid(unsigned long scn_addr)
  531. {
  532. struct device_node *memory = NULL;
  533. nodemask_t nodes;
  534. int default_nid = any_online_node(NODE_MASK_ALL);
  535. int nid;
  536. if (!numa_enabled || (min_common_depth < 0))
  537. return default_nid;
  538. while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
  539. unsigned long start, size;
  540. int ranges;
  541. const unsigned int *memcell_buf;
  542. unsigned int len;
  543. memcell_buf = get_property(memory, "reg", &len);
  544. if (!memcell_buf || len <= 0)
  545. continue;
  546. /* ranges in cell */
  547. ranges = (len >> 2) / (n_mem_addr_cells + n_mem_size_cells);
  548. ha_new_range:
  549. start = read_n_cells(n_mem_addr_cells, &memcell_buf);
  550. size = read_n_cells(n_mem_size_cells, &memcell_buf);
  551. nid = of_node_to_nid_single(memory);
  552. /* Domains not present at boot default to 0 */
  553. if (nid < 0 || !node_online(nid))
  554. nid = default_nid;
  555. if ((scn_addr >= start) && (scn_addr < (start + size))) {
  556. of_node_put(memory);
  557. goto got_nid;
  558. }
  559. if (--ranges) /* process all ranges in cell */
  560. goto ha_new_range;
  561. }
  562. BUG(); /* section address should be found above */
  563. return 0;
  564. /* Temporary code to ensure that returned node is not empty */
  565. got_nid:
  566. nodes_setall(nodes);
  567. while (NODE_DATA(nid)->node_spanned_pages == 0) {
  568. node_clear(nid, nodes);
  569. nid = any_online_node(nodes);
  570. }
  571. return nid;
  572. }
  573. #endif /* CONFIG_MEMORY_HOTPLUG */