node.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. /*
  2. * drivers/base/node.c - basic Node class support
  3. */
  4. #include <linux/sysdev.h>
  5. #include <linux/module.h>
  6. #include <linux/init.h>
  7. #include <linux/mm.h>
  8. #include <linux/memory.h>
  9. #include <linux/node.h>
  10. #include <linux/hugetlb.h>
  11. #include <linux/cpumask.h>
  12. #include <linux/topology.h>
  13. #include <linux/nodemask.h>
  14. #include <linux/cpu.h>
  15. #include <linux/device.h>
  16. #include <linux/swap.h>
  17. static struct sysdev_class node_class = {
  18. .name = "node",
  19. };
  20. static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf)
  21. {
  22. struct node *node_dev = to_node(dev);
  23. const struct cpumask *mask = cpumask_of_node(node_dev->sysdev.id);
  24. int len;
  25. /* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */
  26. BUILD_BUG_ON((NR_CPUS/32 * 9) > (PAGE_SIZE-1));
  27. len = type?
  28. cpulist_scnprintf(buf, PAGE_SIZE-2, mask) :
  29. cpumask_scnprintf(buf, PAGE_SIZE-2, mask);
  30. buf[len++] = '\n';
  31. buf[len] = '\0';
  32. return len;
  33. }
  34. static inline ssize_t node_read_cpumask(struct sys_device *dev,
  35. struct sysdev_attribute *attr, char *buf)
  36. {
  37. return node_read_cpumap(dev, 0, buf);
  38. }
  39. static inline ssize_t node_read_cpulist(struct sys_device *dev,
  40. struct sysdev_attribute *attr, char *buf)
  41. {
  42. return node_read_cpumap(dev, 1, buf);
  43. }
  44. static SYSDEV_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL);
  45. static SYSDEV_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL);
  46. #define K(x) ((x) << (PAGE_SHIFT - 10))
  47. static ssize_t node_read_meminfo(struct sys_device * dev,
  48. struct sysdev_attribute *attr, char * buf)
  49. {
  50. int n;
  51. int nid = dev->id;
  52. struct sysinfo i;
  53. si_meminfo_node(&i, nid);
  54. n = sprintf(buf, "\n"
  55. "Node %d MemTotal: %8lu kB\n"
  56. "Node %d MemFree: %8lu kB\n"
  57. "Node %d MemUsed: %8lu kB\n"
  58. "Node %d Active: %8lu kB\n"
  59. "Node %d Inactive: %8lu kB\n"
  60. "Node %d Active(anon): %8lu kB\n"
  61. "Node %d Inactive(anon): %8lu kB\n"
  62. "Node %d Active(file): %8lu kB\n"
  63. "Node %d Inactive(file): %8lu kB\n"
  64. "Node %d Unevictable: %8lu kB\n"
  65. "Node %d Mlocked: %8lu kB\n"
  66. #ifdef CONFIG_HIGHMEM
  67. "Node %d HighTotal: %8lu kB\n"
  68. "Node %d HighFree: %8lu kB\n"
  69. "Node %d LowTotal: %8lu kB\n"
  70. "Node %d LowFree: %8lu kB\n"
  71. #endif
  72. "Node %d Dirty: %8lu kB\n"
  73. "Node %d Writeback: %8lu kB\n"
  74. "Node %d FilePages: %8lu kB\n"
  75. "Node %d Mapped: %8lu kB\n"
  76. "Node %d AnonPages: %8lu kB\n"
  77. "Node %d Shmem: %8lu kB\n"
  78. "Node %d KernelStack: %8lu kB\n"
  79. "Node %d PageTables: %8lu kB\n"
  80. "Node %d NFS_Unstable: %8lu kB\n"
  81. "Node %d Bounce: %8lu kB\n"
  82. "Node %d WritebackTmp: %8lu kB\n"
  83. "Node %d Slab: %8lu kB\n"
  84. "Node %d SReclaimable: %8lu kB\n"
  85. "Node %d SUnreclaim: %8lu kB\n",
  86. nid, K(i.totalram),
  87. nid, K(i.freeram),
  88. nid, K(i.totalram - i.freeram),
  89. nid, K(node_page_state(nid, NR_ACTIVE_ANON) +
  90. node_page_state(nid, NR_ACTIVE_FILE)),
  91. nid, K(node_page_state(nid, NR_INACTIVE_ANON) +
  92. node_page_state(nid, NR_INACTIVE_FILE)),
  93. nid, K(node_page_state(nid, NR_ACTIVE_ANON)),
  94. nid, K(node_page_state(nid, NR_INACTIVE_ANON)),
  95. nid, K(node_page_state(nid, NR_ACTIVE_FILE)),
  96. nid, K(node_page_state(nid, NR_INACTIVE_FILE)),
  97. nid, K(node_page_state(nid, NR_UNEVICTABLE)),
  98. nid, K(node_page_state(nid, NR_MLOCK)),
  99. #ifdef CONFIG_HIGHMEM
  100. nid, K(i.totalhigh),
  101. nid, K(i.freehigh),
  102. nid, K(i.totalram - i.totalhigh),
  103. nid, K(i.freeram - i.freehigh),
  104. #endif
  105. nid, K(node_page_state(nid, NR_FILE_DIRTY)),
  106. nid, K(node_page_state(nid, NR_WRITEBACK)),
  107. nid, K(node_page_state(nid, NR_FILE_PAGES)),
  108. nid, K(node_page_state(nid, NR_FILE_MAPPED)),
  109. nid, K(node_page_state(nid, NR_ANON_PAGES)),
  110. nid, K(node_page_state(nid, NR_SHMEM)),
  111. nid, node_page_state(nid, NR_KERNEL_STACK) *
  112. THREAD_SIZE / 1024,
  113. nid, K(node_page_state(nid, NR_PAGETABLE)),
  114. nid, K(node_page_state(nid, NR_UNSTABLE_NFS)),
  115. nid, K(node_page_state(nid, NR_BOUNCE)),
  116. nid, K(node_page_state(nid, NR_WRITEBACK_TEMP)),
  117. nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE) +
  118. node_page_state(nid, NR_SLAB_UNRECLAIMABLE)),
  119. nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE)),
  120. nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE)));
  121. n += hugetlb_report_node_meminfo(nid, buf + n);
  122. return n;
  123. }
  124. #undef K
  125. static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL);
  126. static ssize_t node_read_numastat(struct sys_device * dev,
  127. struct sysdev_attribute *attr, char * buf)
  128. {
  129. return sprintf(buf,
  130. "numa_hit %lu\n"
  131. "numa_miss %lu\n"
  132. "numa_foreign %lu\n"
  133. "interleave_hit %lu\n"
  134. "local_node %lu\n"
  135. "other_node %lu\n",
  136. node_page_state(dev->id, NUMA_HIT),
  137. node_page_state(dev->id, NUMA_MISS),
  138. node_page_state(dev->id, NUMA_FOREIGN),
  139. node_page_state(dev->id, NUMA_INTERLEAVE_HIT),
  140. node_page_state(dev->id, NUMA_LOCAL),
  141. node_page_state(dev->id, NUMA_OTHER));
  142. }
  143. static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
  144. static ssize_t node_read_distance(struct sys_device * dev,
  145. struct sysdev_attribute *attr, char * buf)
  146. {
  147. int nid = dev->id;
  148. int len = 0;
  149. int i;
  150. /* buf currently PAGE_SIZE, need ~4 chars per node */
  151. BUILD_BUG_ON(MAX_NUMNODES*4 > PAGE_SIZE/2);
  152. for_each_online_node(i)
  153. len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i));
  154. len += sprintf(buf + len, "\n");
  155. return len;
  156. }
  157. static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL);
  158. #ifdef CONFIG_HUGETLBFS
  159. /*
  160. * hugetlbfs per node attributes registration interface:
  161. * When/if hugetlb[fs] subsystem initializes [sometime after this module],
  162. * it will register its per node attributes for all online nodes with
  163. * memory. It will also call register_hugetlbfs_with_node(), below, to
  164. * register its attribute registration functions with this node driver.
  165. * Once these hooks have been initialized, the node driver will call into
  166. * the hugetlb module to [un]register attributes for hot-plugged nodes.
  167. */
  168. static node_registration_func_t __hugetlb_register_node;
  169. static node_registration_func_t __hugetlb_unregister_node;
  170. static inline bool hugetlb_register_node(struct node *node)
  171. {
  172. if (__hugetlb_register_node &&
  173. node_state(node->sysdev.id, N_HIGH_MEMORY)) {
  174. __hugetlb_register_node(node);
  175. return true;
  176. }
  177. return false;
  178. }
  179. static inline void hugetlb_unregister_node(struct node *node)
  180. {
  181. if (__hugetlb_unregister_node)
  182. __hugetlb_unregister_node(node);
  183. }
  184. void register_hugetlbfs_with_node(node_registration_func_t doregister,
  185. node_registration_func_t unregister)
  186. {
  187. __hugetlb_register_node = doregister;
  188. __hugetlb_unregister_node = unregister;
  189. }
  190. #else
  191. static inline void hugetlb_register_node(struct node *node) {}
  192. static inline void hugetlb_unregister_node(struct node *node) {}
  193. #endif
  194. /*
  195. * register_node - Setup a sysfs device for a node.
  196. * @num - Node number to use when creating the device.
  197. *
  198. * Initialize and register the node device.
  199. */
  200. int register_node(struct node *node, int num, struct node *parent)
  201. {
  202. int error;
  203. node->sysdev.id = num;
  204. node->sysdev.cls = &node_class;
  205. error = sysdev_register(&node->sysdev);
  206. if (!error){
  207. sysdev_create_file(&node->sysdev, &attr_cpumap);
  208. sysdev_create_file(&node->sysdev, &attr_cpulist);
  209. sysdev_create_file(&node->sysdev, &attr_meminfo);
  210. sysdev_create_file(&node->sysdev, &attr_numastat);
  211. sysdev_create_file(&node->sysdev, &attr_distance);
  212. scan_unevictable_register_node(node);
  213. hugetlb_register_node(node);
  214. }
  215. return error;
  216. }
  217. /**
  218. * unregister_node - unregister a node device
  219. * @node: node going away
  220. *
  221. * Unregisters a node device @node. All the devices on the node must be
  222. * unregistered before calling this function.
  223. */
  224. void unregister_node(struct node *node)
  225. {
  226. sysdev_remove_file(&node->sysdev, &attr_cpumap);
  227. sysdev_remove_file(&node->sysdev, &attr_cpulist);
  228. sysdev_remove_file(&node->sysdev, &attr_meminfo);
  229. sysdev_remove_file(&node->sysdev, &attr_numastat);
  230. sysdev_remove_file(&node->sysdev, &attr_distance);
  231. scan_unevictable_unregister_node(node);
  232. hugetlb_unregister_node(node); /* no-op, if memoryless node */
  233. sysdev_unregister(&node->sysdev);
  234. }
  235. struct node node_devices[MAX_NUMNODES];
  236. /*
  237. * register cpu under node
  238. */
  239. int register_cpu_under_node(unsigned int cpu, unsigned int nid)
  240. {
  241. int ret;
  242. struct sys_device *obj;
  243. if (!node_online(nid))
  244. return 0;
  245. obj = get_cpu_sysdev(cpu);
  246. if (!obj)
  247. return 0;
  248. ret = sysfs_create_link(&node_devices[nid].sysdev.kobj,
  249. &obj->kobj,
  250. kobject_name(&obj->kobj));
  251. if (ret)
  252. return ret;
  253. return sysfs_create_link(&obj->kobj,
  254. &node_devices[nid].sysdev.kobj,
  255. kobject_name(&node_devices[nid].sysdev.kobj));
  256. }
  257. int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
  258. {
  259. struct sys_device *obj;
  260. if (!node_online(nid))
  261. return 0;
  262. obj = get_cpu_sysdev(cpu);
  263. if (!obj)
  264. return 0;
  265. sysfs_remove_link(&node_devices[nid].sysdev.kobj,
  266. kobject_name(&obj->kobj));
  267. sysfs_remove_link(&obj->kobj,
  268. kobject_name(&node_devices[nid].sysdev.kobj));
  269. return 0;
  270. }
  271. #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
  272. #define page_initialized(page) (page->lru.next)
  273. static int get_nid_for_pfn(unsigned long pfn)
  274. {
  275. struct page *page;
  276. if (!pfn_valid_within(pfn))
  277. return -1;
  278. page = pfn_to_page(pfn);
  279. if (!page_initialized(page))
  280. return -1;
  281. return pfn_to_nid(pfn);
  282. }
  283. /* register memory section under specified node if it spans that node */
  284. int register_mem_sect_under_node(struct memory_block *mem_blk, int nid)
  285. {
  286. int ret;
  287. unsigned long pfn, sect_start_pfn, sect_end_pfn;
  288. if (!mem_blk)
  289. return -EFAULT;
  290. if (!node_online(nid))
  291. return 0;
  292. sect_start_pfn = section_nr_to_pfn(mem_blk->phys_index);
  293. sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
  294. for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
  295. int page_nid;
  296. page_nid = get_nid_for_pfn(pfn);
  297. if (page_nid < 0)
  298. continue;
  299. if (page_nid != nid)
  300. continue;
  301. ret = sysfs_create_link_nowarn(&node_devices[nid].sysdev.kobj,
  302. &mem_blk->sysdev.kobj,
  303. kobject_name(&mem_blk->sysdev.kobj));
  304. if (ret)
  305. return ret;
  306. return sysfs_create_link_nowarn(&mem_blk->sysdev.kobj,
  307. &node_devices[nid].sysdev.kobj,
  308. kobject_name(&node_devices[nid].sysdev.kobj));
  309. }
  310. /* mem section does not span the specified node */
  311. return 0;
  312. }
  313. /* unregister memory section under all nodes that it spans */
  314. int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)
  315. {
  316. NODEMASK_ALLOC(nodemask_t, unlinked_nodes, GFP_KERNEL);
  317. unsigned long pfn, sect_start_pfn, sect_end_pfn;
  318. if (!mem_blk) {
  319. NODEMASK_FREE(unlinked_nodes);
  320. return -EFAULT;
  321. }
  322. if (!unlinked_nodes)
  323. return -ENOMEM;
  324. nodes_clear(*unlinked_nodes);
  325. sect_start_pfn = section_nr_to_pfn(mem_blk->phys_index);
  326. sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
  327. for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) {
  328. int nid;
  329. nid = get_nid_for_pfn(pfn);
  330. if (nid < 0)
  331. continue;
  332. if (!node_online(nid))
  333. continue;
  334. if (node_test_and_set(nid, *unlinked_nodes))
  335. continue;
  336. sysfs_remove_link(&node_devices[nid].sysdev.kobj,
  337. kobject_name(&mem_blk->sysdev.kobj));
  338. sysfs_remove_link(&mem_blk->sysdev.kobj,
  339. kobject_name(&node_devices[nid].sysdev.kobj));
  340. }
  341. NODEMASK_FREE(unlinked_nodes);
  342. return 0;
  343. }
  344. static int link_mem_sections(int nid)
  345. {
  346. unsigned long start_pfn = NODE_DATA(nid)->node_start_pfn;
  347. unsigned long end_pfn = start_pfn + NODE_DATA(nid)->node_spanned_pages;
  348. unsigned long pfn;
  349. int err = 0;
  350. for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
  351. unsigned long section_nr = pfn_to_section_nr(pfn);
  352. struct mem_section *mem_sect;
  353. struct memory_block *mem_blk;
  354. int ret;
  355. if (!present_section_nr(section_nr))
  356. continue;
  357. mem_sect = __nr_to_section(section_nr);
  358. mem_blk = find_memory_block(mem_sect);
  359. ret = register_mem_sect_under_node(mem_blk, nid);
  360. if (!err)
  361. err = ret;
  362. /* discard ref obtained in find_memory_block() */
  363. kobject_put(&mem_blk->sysdev.kobj);
  364. }
  365. return err;
  366. }
  367. #ifdef CONFIG_HUGETLBFS
  368. /*
  369. * Handle per node hstate attribute [un]registration on transistions
  370. * to/from memoryless state.
  371. */
  372. static void node_hugetlb_work(struct work_struct *work)
  373. {
  374. struct node *node = container_of(work, struct node, node_work);
  375. /*
  376. * We only get here when a node transitions to/from memoryless state.
  377. * We can detect which transition occurred by examining whether the
  378. * node has memory now. hugetlb_register_node() already check this
  379. * so we try to register the attributes. If that fails, then the
  380. * node has transitioned to memoryless, try to unregister the
  381. * attributes.
  382. */
  383. if (!hugetlb_register_node(node))
  384. hugetlb_unregister_node(node);
  385. }
  386. static void init_node_hugetlb_work(int nid)
  387. {
  388. INIT_WORK(&node_devices[nid].node_work, node_hugetlb_work);
  389. }
  390. static int node_memory_callback(struct notifier_block *self,
  391. unsigned long action, void *arg)
  392. {
  393. struct memory_notify *mnb = arg;
  394. int nid = mnb->status_change_nid;
  395. switch (action) {
  396. case MEM_ONLINE:
  397. case MEM_OFFLINE:
  398. /*
  399. * offload per node hstate [un]registration to a work thread
  400. * when transitioning to/from memoryless state.
  401. */
  402. if (nid != NUMA_NO_NODE)
  403. schedule_work(&node_devices[nid].node_work);
  404. break;
  405. case MEM_GOING_ONLINE:
  406. case MEM_GOING_OFFLINE:
  407. case MEM_CANCEL_ONLINE:
  408. case MEM_CANCEL_OFFLINE:
  409. default:
  410. break;
  411. }
  412. return NOTIFY_OK;
  413. }
  414. #endif /* CONFIG_HUGETLBFS */
  415. #else /* !CONFIG_MEMORY_HOTPLUG_SPARSE */
  416. static int link_mem_sections(int nid) { return 0; }
  417. #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
  418. #if !defined(CONFIG_MEMORY_HOTPLUG_SPARSE) || \
  419. !defined(CONFIG_HUGETLBFS)
  420. static inline int node_memory_callback(struct notifier_block *self,
  421. unsigned long action, void *arg)
  422. {
  423. return NOTIFY_OK;
  424. }
  425. static void init_node_hugetlb_work(int nid) { }
  426. #endif
  427. int register_one_node(int nid)
  428. {
  429. int error = 0;
  430. int cpu;
  431. if (node_online(nid)) {
  432. int p_node = parent_node(nid);
  433. struct node *parent = NULL;
  434. if (p_node != nid)
  435. parent = &node_devices[p_node];
  436. error = register_node(&node_devices[nid], nid, parent);
  437. /* link cpu under this node */
  438. for_each_present_cpu(cpu) {
  439. if (cpu_to_node(cpu) == nid)
  440. register_cpu_under_node(cpu, nid);
  441. }
  442. /* link memory sections under this node */
  443. error = link_mem_sections(nid);
  444. /* initialize work queue for memory hot plug */
  445. init_node_hugetlb_work(nid);
  446. }
  447. return error;
  448. }
  449. void unregister_one_node(int nid)
  450. {
  451. unregister_node(&node_devices[nid]);
  452. }
  453. /*
  454. * node states attributes
  455. */
  456. static ssize_t print_nodes_state(enum node_states state, char *buf)
  457. {
  458. int n;
  459. n = nodelist_scnprintf(buf, PAGE_SIZE, node_states[state]);
  460. if (n > 0 && PAGE_SIZE > n + 1) {
  461. *(buf + n++) = '\n';
  462. *(buf + n++) = '\0';
  463. }
  464. return n;
  465. }
  466. static ssize_t print_nodes_possible(struct sysdev_class *class, char *buf)
  467. {
  468. return print_nodes_state(N_POSSIBLE, buf);
  469. }
  470. static ssize_t print_nodes_online(struct sysdev_class *class, char *buf)
  471. {
  472. return print_nodes_state(N_ONLINE, buf);
  473. }
  474. static ssize_t print_nodes_has_normal_memory(struct sysdev_class *class,
  475. char *buf)
  476. {
  477. return print_nodes_state(N_NORMAL_MEMORY, buf);
  478. }
  479. static ssize_t print_nodes_has_cpu(struct sysdev_class *class, char *buf)
  480. {
  481. return print_nodes_state(N_CPU, buf);
  482. }
  483. static SYSDEV_CLASS_ATTR(possible, 0444, print_nodes_possible, NULL);
  484. static SYSDEV_CLASS_ATTR(online, 0444, print_nodes_online, NULL);
  485. static SYSDEV_CLASS_ATTR(has_normal_memory, 0444, print_nodes_has_normal_memory,
  486. NULL);
  487. static SYSDEV_CLASS_ATTR(has_cpu, 0444, print_nodes_has_cpu, NULL);
  488. #ifdef CONFIG_HIGHMEM
  489. static ssize_t print_nodes_has_high_memory(struct sysdev_class *class,
  490. char *buf)
  491. {
  492. return print_nodes_state(N_HIGH_MEMORY, buf);
  493. }
  494. static SYSDEV_CLASS_ATTR(has_high_memory, 0444, print_nodes_has_high_memory,
  495. NULL);
  496. #endif
  497. struct sysdev_class_attribute *node_state_attr[] = {
  498. &attr_possible,
  499. &attr_online,
  500. &attr_has_normal_memory,
  501. #ifdef CONFIG_HIGHMEM
  502. &attr_has_high_memory,
  503. #endif
  504. &attr_has_cpu,
  505. };
  506. static int node_states_init(void)
  507. {
  508. int i;
  509. int err = 0;
  510. for (i = 0; i < NR_NODE_STATES; i++) {
  511. int ret;
  512. ret = sysdev_class_create_file(&node_class, node_state_attr[i]);
  513. if (!err)
  514. err = ret;
  515. }
  516. return err;
  517. }
  518. #define NODE_CALLBACK_PRI 2 /* lower than SLAB */
  519. static int __init register_node_type(void)
  520. {
  521. int ret;
  522. ret = sysdev_class_register(&node_class);
  523. if (!ret) {
  524. ret = node_states_init();
  525. hotplug_memory_notifier(node_memory_callback,
  526. NODE_CALLBACK_PRI);
  527. }
  528. /*
  529. * Note: we're not going to unregister the node class if we fail
  530. * to register the node state class attribute files.
  531. */
  532. return ret;
  533. }
  534. postcore_initcall(register_node_type);