discontig.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2000, 2003 Silicon Graphics, Inc. All rights reserved.
  4. * Copyright (c) 2001 Intel Corp.
  5. * Copyright (c) 2001 Tony Luck <tony.luck@intel.com>
  6. * Copyright (c) 2002 NEC Corp.
  7. * Copyright (c) 2002 Kimio Suganuma <k-suganuma@da.jp.nec.com>
  8. * Copyright (c) 2004 Silicon Graphics, Inc
  9. * Russ Anderson <rja@sgi.com>
  10. * Jesse Barnes <jbarnes@sgi.com>
  11. * Jack Steiner <steiner@sgi.com>
  12. */
  13. /*
  14. * Platform initialization for Discontig Memory
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/mm.h>
  18. #include <linux/nmi.h>
  19. #include <linux/swap.h>
  20. #include <linux/memblock.h>
  21. #include <linux/acpi.h>
  22. #include <linux/efi.h>
  23. #include <linux/nodemask.h>
  24. #include <linux/slab.h>
  25. #include <asm/pgalloc.h>
  26. #include <asm/tlb.h>
  27. #include <asm/meminit.h>
  28. #include <asm/numa.h>
  29. #include <asm/sections.h>
  30. /*
  31. * Track per-node information needed to setup the boot memory allocator, the
  32. * per-node areas, and the real VM.
  33. */
  34. struct early_node_data {
  35. struct ia64_node_data *node_data;
  36. unsigned long pernode_addr;
  37. unsigned long pernode_size;
  38. unsigned long min_pfn;
  39. unsigned long max_pfn;
  40. };
  41. static struct early_node_data mem_data[MAX_NUMNODES] __initdata;
  42. static nodemask_t memory_less_mask __initdata;
  43. pg_data_t *pgdat_list[MAX_NUMNODES];
  44. /*
  45. * To prevent cache aliasing effects, align per-node structures so that they
  46. * start at addresses that are strided by node number.
  47. */
  48. #define MAX_NODE_ALIGN_OFFSET (32 * 1024 * 1024)
  49. #define NODEDATA_ALIGN(addr, node) \
  50. ((((addr) + 1024*1024-1) & ~(1024*1024-1)) + \
  51. (((node)*PERCPU_PAGE_SIZE) & (MAX_NODE_ALIGN_OFFSET - 1)))
  52. /**
  53. * build_node_maps - callback to setup mem_data structs for each node
  54. * @start: physical start of range
  55. * @len: length of range
  56. * @node: node where this range resides
  57. *
  58. * Detect extents of each piece of memory that we wish to
  59. * treat as a virtually contiguous block (i.e. each node). Each such block
  60. * must start on an %IA64_GRANULE_SIZE boundary, so we round the address down
  61. * if necessary. Any non-existent pages will simply be part of the virtual
  62. * memmap.
  63. */
  64. static int __init build_node_maps(unsigned long start, unsigned long len,
  65. int node)
  66. {
  67. unsigned long spfn, epfn, end = start + len;
  68. epfn = GRANULEROUNDUP(end) >> PAGE_SHIFT;
  69. spfn = GRANULEROUNDDOWN(start) >> PAGE_SHIFT;
  70. if (!mem_data[node].min_pfn) {
  71. mem_data[node].min_pfn = spfn;
  72. mem_data[node].max_pfn = epfn;
  73. } else {
  74. mem_data[node].min_pfn = min(spfn, mem_data[node].min_pfn);
  75. mem_data[node].max_pfn = max(epfn, mem_data[node].max_pfn);
  76. }
  77. return 0;
  78. }
  79. /**
  80. * early_nr_cpus_node - return number of cpus on a given node
  81. * @node: node to check
  82. *
  83. * Count the number of cpus on @node. We can't use nr_cpus_node() yet because
  84. * acpi_boot_init() (which builds the node_to_cpu_mask array) hasn't been
  85. * called yet. Note that node 0 will also count all non-existent cpus.
  86. */
  87. static int __meminit early_nr_cpus_node(int node)
  88. {
  89. int cpu, n = 0;
  90. for_each_possible_early_cpu(cpu)
  91. if (node == node_cpuid[cpu].nid)
  92. n++;
  93. return n;
  94. }
  95. /**
  96. * compute_pernodesize - compute size of pernode data
  97. * @node: the node id.
  98. */
  99. static unsigned long __meminit compute_pernodesize(int node)
  100. {
  101. unsigned long pernodesize = 0, cpus;
  102. cpus = early_nr_cpus_node(node);
  103. pernodesize += PERCPU_PAGE_SIZE * cpus;
  104. pernodesize += node * L1_CACHE_BYTES;
  105. pernodesize += L1_CACHE_ALIGN(sizeof(pg_data_t));
  106. pernodesize += L1_CACHE_ALIGN(sizeof(struct ia64_node_data));
  107. pernodesize += L1_CACHE_ALIGN(sizeof(pg_data_t));
  108. pernodesize = PAGE_ALIGN(pernodesize);
  109. return pernodesize;
  110. }
  111. /**
  112. * per_cpu_node_setup - setup per-cpu areas on each node
  113. * @cpu_data: per-cpu area on this node
  114. * @node: node to setup
  115. *
  116. * Copy the static per-cpu data into the region we just set aside and then
  117. * setup __per_cpu_offset for each CPU on this node. Return a pointer to
  118. * the end of the area.
  119. */
  120. static void *per_cpu_node_setup(void *cpu_data, int node)
  121. {
  122. #ifdef CONFIG_SMP
  123. int cpu;
  124. for_each_possible_early_cpu(cpu) {
  125. void *src = cpu == 0 ? __cpu0_per_cpu : __phys_per_cpu_start;
  126. if (node != node_cpuid[cpu].nid)
  127. continue;
  128. memcpy(__va(cpu_data), src, __per_cpu_end - __per_cpu_start);
  129. __per_cpu_offset[cpu] = (char *)__va(cpu_data) -
  130. __per_cpu_start;
  131. /*
  132. * percpu area for cpu0 is moved from the __init area
  133. * which is setup by head.S and used till this point.
  134. * Update ar.k3. This move is ensures that percpu
  135. * area for cpu0 is on the correct node and its
  136. * virtual address isn't insanely far from other
  137. * percpu areas which is important for congruent
  138. * percpu allocator.
  139. */
  140. if (cpu == 0)
  141. ia64_set_kr(IA64_KR_PER_CPU_DATA,
  142. (unsigned long)cpu_data -
  143. (unsigned long)__per_cpu_start);
  144. cpu_data += PERCPU_PAGE_SIZE;
  145. }
  146. #endif
  147. return cpu_data;
  148. }
  149. #ifdef CONFIG_SMP
  150. /**
  151. * setup_per_cpu_areas - setup percpu areas
  152. *
  153. * Arch code has already allocated and initialized percpu areas. All
  154. * this function has to do is to teach the determined layout to the
  155. * dynamic percpu allocator, which happens to be more complex than
  156. * creating whole new ones using helpers.
  157. */
  158. void __init setup_per_cpu_areas(void)
  159. {
  160. struct pcpu_alloc_info *ai;
  161. struct pcpu_group_info *uninitialized_var(gi);
  162. unsigned int *cpu_map;
  163. void *base;
  164. unsigned long base_offset;
  165. unsigned int cpu;
  166. ssize_t static_size, reserved_size, dyn_size;
  167. int node, prev_node, unit, nr_units, rc;
  168. ai = pcpu_alloc_alloc_info(MAX_NUMNODES, nr_cpu_ids);
  169. if (!ai)
  170. panic("failed to allocate pcpu_alloc_info");
  171. cpu_map = ai->groups[0].cpu_map;
  172. /* determine base */
  173. base = (void *)ULONG_MAX;
  174. for_each_possible_cpu(cpu)
  175. base = min(base,
  176. (void *)(__per_cpu_offset[cpu] + __per_cpu_start));
  177. base_offset = (void *)__per_cpu_start - base;
  178. /* build cpu_map, units are grouped by node */
  179. unit = 0;
  180. for_each_node(node)
  181. for_each_possible_cpu(cpu)
  182. if (node == node_cpuid[cpu].nid)
  183. cpu_map[unit++] = cpu;
  184. nr_units = unit;
  185. /* set basic parameters */
  186. static_size = __per_cpu_end - __per_cpu_start;
  187. reserved_size = PERCPU_MODULE_RESERVE;
  188. dyn_size = PERCPU_PAGE_SIZE - static_size - reserved_size;
  189. if (dyn_size < 0)
  190. panic("percpu area overflow static=%zd reserved=%zd\n",
  191. static_size, reserved_size);
  192. ai->static_size = static_size;
  193. ai->reserved_size = reserved_size;
  194. ai->dyn_size = dyn_size;
  195. ai->unit_size = PERCPU_PAGE_SIZE;
  196. ai->atom_size = PAGE_SIZE;
  197. ai->alloc_size = PERCPU_PAGE_SIZE;
  198. /*
  199. * CPUs are put into groups according to node. Walk cpu_map
  200. * and create new groups at node boundaries.
  201. */
  202. prev_node = -1;
  203. ai->nr_groups = 0;
  204. for (unit = 0; unit < nr_units; unit++) {
  205. cpu = cpu_map[unit];
  206. node = node_cpuid[cpu].nid;
  207. if (node == prev_node) {
  208. gi->nr_units++;
  209. continue;
  210. }
  211. prev_node = node;
  212. gi = &ai->groups[ai->nr_groups++];
  213. gi->nr_units = 1;
  214. gi->base_offset = __per_cpu_offset[cpu] + base_offset;
  215. gi->cpu_map = &cpu_map[unit];
  216. }
  217. rc = pcpu_setup_first_chunk(ai, base);
  218. if (rc)
  219. panic("failed to setup percpu area (err=%d)", rc);
  220. pcpu_free_alloc_info(ai);
  221. }
  222. #endif
  223. /**
  224. * fill_pernode - initialize pernode data.
  225. * @node: the node id.
  226. * @pernode: physical address of pernode data
  227. * @pernodesize: size of the pernode data
  228. */
  229. static void __init fill_pernode(int node, unsigned long pernode,
  230. unsigned long pernodesize)
  231. {
  232. void *cpu_data;
  233. int cpus = early_nr_cpus_node(node);
  234. mem_data[node].pernode_addr = pernode;
  235. mem_data[node].pernode_size = pernodesize;
  236. memset(__va(pernode), 0, pernodesize);
  237. cpu_data = (void *)pernode;
  238. pernode += PERCPU_PAGE_SIZE * cpus;
  239. pernode += node * L1_CACHE_BYTES;
  240. pgdat_list[node] = __va(pernode);
  241. pernode += L1_CACHE_ALIGN(sizeof(pg_data_t));
  242. mem_data[node].node_data = __va(pernode);
  243. pernode += L1_CACHE_ALIGN(sizeof(struct ia64_node_data));
  244. pernode += L1_CACHE_ALIGN(sizeof(pg_data_t));
  245. cpu_data = per_cpu_node_setup(cpu_data, node);
  246. return;
  247. }
  248. /**
  249. * find_pernode_space - allocate memory for memory map and per-node structures
  250. * @start: physical start of range
  251. * @len: length of range
  252. * @node: node where this range resides
  253. *
  254. * This routine reserves space for the per-cpu data struct, the list of
  255. * pg_data_ts and the per-node data struct. Each node will have something like
  256. * the following in the first chunk of addr. space large enough to hold it.
  257. *
  258. * ________________________
  259. * | |
  260. * |~~~~~~~~~~~~~~~~~~~~~~~~| <-- NODEDATA_ALIGN(start, node) for the first
  261. * | PERCPU_PAGE_SIZE * | start and length big enough
  262. * | cpus_on_this_node | Node 0 will also have entries for all non-existent cpus.
  263. * |------------------------|
  264. * | local pg_data_t * |
  265. * |------------------------|
  266. * | local ia64_node_data |
  267. * |------------------------|
  268. * | ??? |
  269. * |________________________|
  270. *
  271. * Once this space has been set aside, the bootmem maps are initialized. We
  272. * could probably move the allocation of the per-cpu and ia64_node_data space
  273. * outside of this function and use alloc_bootmem_node(), but doing it here
  274. * is straightforward and we get the alignments we want so...
  275. */
  276. static int __init find_pernode_space(unsigned long start, unsigned long len,
  277. int node)
  278. {
  279. unsigned long spfn, epfn;
  280. unsigned long pernodesize = 0, pernode;
  281. spfn = start >> PAGE_SHIFT;
  282. epfn = (start + len) >> PAGE_SHIFT;
  283. /*
  284. * Make sure this memory falls within this node's usable memory
  285. * since we may have thrown some away in build_maps().
  286. */
  287. if (spfn < mem_data[node].min_pfn || epfn > mem_data[node].max_pfn)
  288. return 0;
  289. /* Don't setup this node's local space twice... */
  290. if (mem_data[node].pernode_addr)
  291. return 0;
  292. /*
  293. * Calculate total size needed, incl. what's necessary
  294. * for good alignment and alias prevention.
  295. */
  296. pernodesize = compute_pernodesize(node);
  297. pernode = NODEDATA_ALIGN(start, node);
  298. /* Is this range big enough for what we want to store here? */
  299. if (start + len > (pernode + pernodesize))
  300. fill_pernode(node, pernode, pernodesize);
  301. return 0;
  302. }
  303. /**
  304. * reserve_pernode_space - reserve memory for per-node space
  305. *
  306. * Reserve the space used by the bootmem maps & per-node space in the boot
  307. * allocator so that when we actually create the real mem maps we don't
  308. * use their memory.
  309. */
  310. static void __init reserve_pernode_space(void)
  311. {
  312. unsigned long base, size;
  313. int node;
  314. for_each_online_node(node) {
  315. if (node_isset(node, memory_less_mask))
  316. continue;
  317. /* Now the per-node space */
  318. size = mem_data[node].pernode_size;
  319. base = __pa(mem_data[node].pernode_addr);
  320. memblock_reserve(base, size);
  321. }
  322. }
  323. static void __meminit scatter_node_data(void)
  324. {
  325. pg_data_t **dst;
  326. int node;
  327. /*
  328. * for_each_online_node() can't be used at here.
  329. * node_online_map is not set for hot-added nodes at this time,
  330. * because we are halfway through initialization of the new node's
  331. * structures. If for_each_online_node() is used, a new node's
  332. * pg_data_ptrs will be not initialized. Instead of using it,
  333. * pgdat_list[] is checked.
  334. */
  335. for_each_node(node) {
  336. if (pgdat_list[node]) {
  337. dst = LOCAL_DATA_ADDR(pgdat_list[node])->pg_data_ptrs;
  338. memcpy(dst, pgdat_list, sizeof(pgdat_list));
  339. }
  340. }
  341. }
  342. /**
  343. * initialize_pernode_data - fixup per-cpu & per-node pointers
  344. *
  345. * Each node's per-node area has a copy of the global pg_data_t list, so
  346. * we copy that to each node here, as well as setting the per-cpu pointer
  347. * to the local node data structure. The active_cpus field of the per-node
  348. * structure gets setup by the platform_cpu_init() function later.
  349. */
  350. static void __init initialize_pernode_data(void)
  351. {
  352. int cpu, node;
  353. scatter_node_data();
  354. #ifdef CONFIG_SMP
  355. /* Set the node_data pointer for each per-cpu struct */
  356. for_each_possible_early_cpu(cpu) {
  357. node = node_cpuid[cpu].nid;
  358. per_cpu(ia64_cpu_info, cpu).node_data =
  359. mem_data[node].node_data;
  360. }
  361. #else
  362. {
  363. struct cpuinfo_ia64 *cpu0_cpu_info;
  364. cpu = 0;
  365. node = node_cpuid[cpu].nid;
  366. cpu0_cpu_info = (struct cpuinfo_ia64 *)(__phys_per_cpu_start +
  367. ((char *)&ia64_cpu_info - __per_cpu_start));
  368. cpu0_cpu_info->node_data = mem_data[node].node_data;
  369. }
  370. #endif /* CONFIG_SMP */
  371. }
  372. /**
  373. * memory_less_node_alloc - * attempt to allocate memory on the best NUMA slit
  374. * node but fall back to any other node when __alloc_bootmem_node fails
  375. * for best.
  376. * @nid: node id
  377. * @pernodesize: size of this node's pernode data
  378. */
  379. static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
  380. {
  381. void *ptr = NULL;
  382. u8 best = 0xff;
  383. int bestnode = -1, node, anynode = 0;
  384. for_each_online_node(node) {
  385. if (node_isset(node, memory_less_mask))
  386. continue;
  387. else if (node_distance(nid, node) < best) {
  388. best = node_distance(nid, node);
  389. bestnode = node;
  390. }
  391. anynode = node;
  392. }
  393. if (bestnode == -1)
  394. bestnode = anynode;
  395. ptr = memblock_alloc_try_nid(pernodesize, PERCPU_PAGE_SIZE,
  396. __pa(MAX_DMA_ADDRESS),
  397. MEMBLOCK_ALLOC_ACCESSIBLE,
  398. bestnode);
  399. return ptr;
  400. }
  401. /**
  402. * memory_less_nodes - allocate and initialize CPU only nodes pernode
  403. * information.
  404. */
  405. static void __init memory_less_nodes(void)
  406. {
  407. unsigned long pernodesize;
  408. void *pernode;
  409. int node;
  410. for_each_node_mask(node, memory_less_mask) {
  411. pernodesize = compute_pernodesize(node);
  412. pernode = memory_less_node_alloc(node, pernodesize);
  413. fill_pernode(node, __pa(pernode), pernodesize);
  414. }
  415. return;
  416. }
  417. /**
  418. * find_memory - walk the EFI memory map and setup the bootmem allocator
  419. *
  420. * Called early in boot to setup the bootmem allocator, and to
  421. * allocate the per-cpu and per-node structures.
  422. */
  423. void __init find_memory(void)
  424. {
  425. int node;
  426. reserve_memory();
  427. efi_memmap_walk(filter_memory, register_active_ranges);
  428. if (num_online_nodes() == 0) {
  429. printk(KERN_ERR "node info missing!\n");
  430. node_set_online(0);
  431. }
  432. nodes_or(memory_less_mask, memory_less_mask, node_online_map);
  433. min_low_pfn = -1;
  434. max_low_pfn = 0;
  435. /* These actually end up getting called by call_pernode_memory() */
  436. efi_memmap_walk(filter_rsvd_memory, build_node_maps);
  437. efi_memmap_walk(filter_rsvd_memory, find_pernode_space);
  438. efi_memmap_walk(find_max_min_low_pfn, NULL);
  439. for_each_online_node(node)
  440. if (mem_data[node].min_pfn)
  441. node_clear(node, memory_less_mask);
  442. reserve_pernode_space();
  443. memory_less_nodes();
  444. initialize_pernode_data();
  445. max_pfn = max_low_pfn;
  446. find_initrd();
  447. }
  448. #ifdef CONFIG_SMP
  449. /**
  450. * per_cpu_init - setup per-cpu variables
  451. *
  452. * find_pernode_space() does most of this already, we just need to set
  453. * local_per_cpu_offset
  454. */
  455. void *per_cpu_init(void)
  456. {
  457. int cpu;
  458. static int first_time = 1;
  459. if (first_time) {
  460. first_time = 0;
  461. for_each_possible_early_cpu(cpu)
  462. per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu];
  463. }
  464. return __per_cpu_start + __per_cpu_offset[smp_processor_id()];
  465. }
  466. #endif /* CONFIG_SMP */
  467. /**
  468. * call_pernode_memory - use SRAT to call callback functions with node info
  469. * @start: physical start of range
  470. * @len: length of range
  471. * @arg: function to call for each range
  472. *
  473. * efi_memmap_walk() knows nothing about layout of memory across nodes. Find
  474. * out to which node a block of memory belongs. Ignore memory that we cannot
  475. * identify, and split blocks that run across multiple nodes.
  476. *
  477. * Take this opportunity to round the start address up and the end address
  478. * down to page boundaries.
  479. */
  480. void call_pernode_memory(unsigned long start, unsigned long len, void *arg)
  481. {
  482. unsigned long rs, re, end = start + len;
  483. void (*func)(unsigned long, unsigned long, int);
  484. int i;
  485. start = PAGE_ALIGN(start);
  486. end &= PAGE_MASK;
  487. if (start >= end)
  488. return;
  489. func = arg;
  490. if (!num_node_memblks) {
  491. /* No SRAT table, so assume one node (node 0) */
  492. if (start < end)
  493. (*func)(start, end - start, 0);
  494. return;
  495. }
  496. for (i = 0; i < num_node_memblks; i++) {
  497. rs = max(start, node_memblk[i].start_paddr);
  498. re = min(end, node_memblk[i].start_paddr +
  499. node_memblk[i].size);
  500. if (rs < re)
  501. (*func)(rs, re - rs, node_memblk[i].nid);
  502. if (re == end)
  503. break;
  504. }
  505. }
  506. /**
  507. * paging_init - setup page tables
  508. *
  509. * paging_init() sets up the page tables for each node of the system and frees
  510. * the bootmem allocator memory for general use.
  511. */
  512. void __init paging_init(void)
  513. {
  514. unsigned long max_dma;
  515. unsigned long pfn_offset = 0;
  516. unsigned long max_pfn = 0;
  517. int node;
  518. unsigned long max_zone_pfns[MAX_NR_ZONES];
  519. max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
  520. sparse_memory_present_with_active_regions(MAX_NUMNODES);
  521. sparse_init();
  522. #ifdef CONFIG_VIRTUAL_MEM_MAP
  523. VMALLOC_END -= PAGE_ALIGN(ALIGN(max_low_pfn, MAX_ORDER_NR_PAGES) *
  524. sizeof(struct page));
  525. vmem_map = (struct page *) VMALLOC_END;
  526. efi_memmap_walk(create_mem_map_page_table, NULL);
  527. printk("Virtual mem_map starts at 0x%p\n", vmem_map);
  528. #endif
  529. for_each_online_node(node) {
  530. pfn_offset = mem_data[node].min_pfn;
  531. #ifdef CONFIG_VIRTUAL_MEM_MAP
  532. NODE_DATA(node)->node_mem_map = vmem_map + pfn_offset;
  533. #endif
  534. if (mem_data[node].max_pfn > max_pfn)
  535. max_pfn = mem_data[node].max_pfn;
  536. }
  537. memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
  538. #ifdef CONFIG_ZONE_DMA32
  539. max_zone_pfns[ZONE_DMA32] = max_dma;
  540. #endif
  541. max_zone_pfns[ZONE_NORMAL] = max_pfn;
  542. free_area_init_nodes(max_zone_pfns);
  543. zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
  544. }
  545. #ifdef CONFIG_MEMORY_HOTPLUG
  546. pg_data_t *arch_alloc_nodedata(int nid)
  547. {
  548. unsigned long size = compute_pernodesize(nid);
  549. return kzalloc(size, GFP_KERNEL);
  550. }
  551. void arch_free_nodedata(pg_data_t *pgdat)
  552. {
  553. kfree(pgdat);
  554. }
  555. void arch_refresh_nodedata(int update_node, pg_data_t *update_pgdat)
  556. {
  557. pgdat_list[update_node] = update_pgdat;
  558. scatter_node_data();
  559. }
  560. #endif
  561. #ifdef CONFIG_SPARSEMEM_VMEMMAP
  562. int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
  563. struct vmem_altmap *altmap)
  564. {
  565. return vmemmap_populate_basepages(start, end, node);
  566. }
  567. void vmemmap_free(unsigned long start, unsigned long end,
  568. struct vmem_altmap *altmap)
  569. {
  570. }
  571. #endif