Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * drivers/base/node.c - basic Node class support |
| 3 | */ |
| 4 | |
| 5 | #include <linux/sysdev.h> |
| 6 | #include <linux/module.h> |
| 7 | #include <linux/init.h> |
| 8 | #include <linux/mm.h> |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 9 | #include <linux/memory.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include <linux/node.h> |
| 11 | #include <linux/hugetlb.h> |
Mel Gorman | ed4a6d7 | 2010-05-24 14:32:29 -0700 | [diff] [blame] | 12 | #include <linux/compaction.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <linux/cpumask.h> |
| 14 | #include <linux/topology.h> |
| 15 | #include <linux/nodemask.h> |
KAMEZAWA Hiroyuki | 76b67ed | 2006-06-27 02:53:41 -0700 | [diff] [blame] | 16 | #include <linux/cpu.h> |
Lee Schermerhorn | bde631a | 2007-10-16 01:26:27 -0700 | [diff] [blame] | 17 | #include <linux/device.h> |
Lee Schermerhorn | af936a1 | 2008-10-18 20:26:53 -0700 | [diff] [blame] | 18 | #include <linux/swap.h> |
Tejun Heo | 18e5b53 | 2010-04-06 19:23:33 +0900 | [diff] [blame] | 19 | #include <linux/slab.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Andi Kleen | 3701cde | 2010-01-05 12:48:04 +0100 | [diff] [blame] | 21 | static struct sysdev_class_attribute *node_state_attrs[]; |
| 22 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | static struct sysdev_class node_class = { |
Kay Sievers | af5ca3f | 2007-12-20 02:09:39 +0100 | [diff] [blame] | 24 | .name = "node", |
Andi Kleen | 3701cde | 2010-01-05 12:48:04 +0100 | [diff] [blame] | 25 | .attrs = node_state_attrs, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | }; |
| 27 | |
| 28 | |
Mike Travis | 39106dc | 2008-04-08 11:43:03 -0700 | [diff] [blame] | 29 | static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | { |
| 31 | struct node *node_dev = to_node(dev); |
Rusty Russell | a70f730 | 2009-03-13 14:49:46 +1030 | [diff] [blame] | 32 | const struct cpumask *mask = cpumask_of_node(node_dev->sysdev.id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | int len; |
| 34 | |
Mike Travis | 39106dc | 2008-04-08 11:43:03 -0700 | [diff] [blame] | 35 | /* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */ |
| 36 | BUILD_BUG_ON((NR_CPUS/32 * 9) > (PAGE_SIZE-1)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | |
Mike Travis | 39106dc | 2008-04-08 11:43:03 -0700 | [diff] [blame] | 38 | len = type? |
Rusty Russell | 29c0177 | 2008-12-13 21:20:25 +1030 | [diff] [blame] | 39 | cpulist_scnprintf(buf, PAGE_SIZE-2, mask) : |
| 40 | cpumask_scnprintf(buf, PAGE_SIZE-2, mask); |
Mike Travis | c5f59f0 | 2008-04-04 18:11:10 -0700 | [diff] [blame] | 41 | buf[len++] = '\n'; |
| 42 | buf[len] = '\0'; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | return len; |
| 44 | } |
| 45 | |
Andi Kleen | 4a0b2b4 | 2008-07-01 18:48:41 +0200 | [diff] [blame] | 46 | static inline ssize_t node_read_cpumask(struct sys_device *dev, |
| 47 | struct sysdev_attribute *attr, char *buf) |
Mike Travis | 39106dc | 2008-04-08 11:43:03 -0700 | [diff] [blame] | 48 | { |
| 49 | return node_read_cpumap(dev, 0, buf); |
| 50 | } |
Andi Kleen | 4a0b2b4 | 2008-07-01 18:48:41 +0200 | [diff] [blame] | 51 | static inline ssize_t node_read_cpulist(struct sys_device *dev, |
| 52 | struct sysdev_attribute *attr, char *buf) |
Mike Travis | 39106dc | 2008-04-08 11:43:03 -0700 | [diff] [blame] | 53 | { |
| 54 | return node_read_cpumap(dev, 1, buf); |
| 55 | } |
| 56 | |
| 57 | static SYSDEV_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL); |
| 58 | static SYSDEV_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | |
| 60 | #define K(x) ((x) << (PAGE_SHIFT - 10)) |
Andi Kleen | 4a0b2b4 | 2008-07-01 18:48:41 +0200 | [diff] [blame] | 61 | static ssize_t node_read_meminfo(struct sys_device * dev, |
| 62 | struct sysdev_attribute *attr, char * buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | { |
| 64 | int n; |
| 65 | int nid = dev->id; |
| 66 | struct sysinfo i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
| 68 | si_meminfo_node(&i, nid); |
KOSAKI Motohiro | 7ee9225 | 2010-08-09 17:19:50 -0700 | [diff] [blame] | 69 | n = sprintf(buf, |
Rik van Riel | 4f98a2f | 2008-10-18 20:26:32 -0700 | [diff] [blame] | 70 | "Node %d MemTotal: %8lu kB\n" |
| 71 | "Node %d MemFree: %8lu kB\n" |
| 72 | "Node %d MemUsed: %8lu kB\n" |
| 73 | "Node %d Active: %8lu kB\n" |
| 74 | "Node %d Inactive: %8lu kB\n" |
| 75 | "Node %d Active(anon): %8lu kB\n" |
| 76 | "Node %d Inactive(anon): %8lu kB\n" |
| 77 | "Node %d Active(file): %8lu kB\n" |
| 78 | "Node %d Inactive(file): %8lu kB\n" |
Nick Piggin | 5344b7e | 2008-10-18 20:26:51 -0700 | [diff] [blame] | 79 | "Node %d Unevictable: %8lu kB\n" |
KOSAKI Motohiro | 7ee9225 | 2010-08-09 17:19:50 -0700 | [diff] [blame] | 80 | "Node %d Mlocked: %8lu kB\n", |
| 81 | nid, K(i.totalram), |
| 82 | nid, K(i.freeram), |
| 83 | nid, K(i.totalram - i.freeram), |
| 84 | nid, K(node_page_state(nid, NR_ACTIVE_ANON) + |
| 85 | node_page_state(nid, NR_ACTIVE_FILE)), |
| 86 | nid, K(node_page_state(nid, NR_INACTIVE_ANON) + |
| 87 | node_page_state(nid, NR_INACTIVE_FILE)), |
| 88 | nid, K(node_page_state(nid, NR_ACTIVE_ANON)), |
| 89 | nid, K(node_page_state(nid, NR_INACTIVE_ANON)), |
| 90 | nid, K(node_page_state(nid, NR_ACTIVE_FILE)), |
| 91 | nid, K(node_page_state(nid, NR_INACTIVE_FILE)), |
| 92 | nid, K(node_page_state(nid, NR_UNEVICTABLE)), |
| 93 | nid, K(node_page_state(nid, NR_MLOCK))); |
| 94 | |
Christoph Lameter | 182e8e2 | 2006-09-25 23:31:10 -0700 | [diff] [blame] | 95 | #ifdef CONFIG_HIGHMEM |
KOSAKI Motohiro | 7ee9225 | 2010-08-09 17:19:50 -0700 | [diff] [blame] | 96 | n += sprintf(buf + n, |
Rik van Riel | 4f98a2f | 2008-10-18 20:26:32 -0700 | [diff] [blame] | 97 | "Node %d HighTotal: %8lu kB\n" |
| 98 | "Node %d HighFree: %8lu kB\n" |
| 99 | "Node %d LowTotal: %8lu kB\n" |
KOSAKI Motohiro | 7ee9225 | 2010-08-09 17:19:50 -0700 | [diff] [blame] | 100 | "Node %d LowFree: %8lu kB\n", |
| 101 | nid, K(i.totalhigh), |
| 102 | nid, K(i.freehigh), |
| 103 | nid, K(i.totalram - i.totalhigh), |
| 104 | nid, K(i.freeram - i.freehigh)); |
Christoph Lameter | 182e8e2 | 2006-09-25 23:31:10 -0700 | [diff] [blame] | 105 | #endif |
KOSAKI Motohiro | 7ee9225 | 2010-08-09 17:19:50 -0700 | [diff] [blame] | 106 | n += sprintf(buf + n, |
Rik van Riel | 4f98a2f | 2008-10-18 20:26:32 -0700 | [diff] [blame] | 107 | "Node %d Dirty: %8lu kB\n" |
| 108 | "Node %d Writeback: %8lu kB\n" |
| 109 | "Node %d FilePages: %8lu kB\n" |
| 110 | "Node %d Mapped: %8lu kB\n" |
| 111 | "Node %d AnonPages: %8lu kB\n" |
KOSAKI Motohiro | 4b02108 | 2009-09-21 17:01:33 -0700 | [diff] [blame] | 112 | "Node %d Shmem: %8lu kB\n" |
KOSAKI Motohiro | c6a7f57 | 2009-09-21 17:01:32 -0700 | [diff] [blame] | 113 | "Node %d KernelStack: %8lu kB\n" |
Rik van Riel | 4f98a2f | 2008-10-18 20:26:32 -0700 | [diff] [blame] | 114 | "Node %d PageTables: %8lu kB\n" |
| 115 | "Node %d NFS_Unstable: %8lu kB\n" |
| 116 | "Node %d Bounce: %8lu kB\n" |
| 117 | "Node %d WritebackTmp: %8lu kB\n" |
| 118 | "Node %d Slab: %8lu kB\n" |
| 119 | "Node %d SReclaimable: %8lu kB\n" |
| 120 | "Node %d SUnreclaim: %8lu kB\n", |
Christoph Lameter | b1e7a8f | 2006-06-30 01:55:39 -0700 | [diff] [blame] | 121 | nid, K(node_page_state(nid, NR_FILE_DIRTY)), |
Christoph Lameter | ce866b3 | 2006-06-30 01:55:40 -0700 | [diff] [blame] | 122 | nid, K(node_page_state(nid, NR_WRITEBACK)), |
Christoph Lameter | 347ce43 | 2006-06-30 01:55:35 -0700 | [diff] [blame] | 123 | nid, K(node_page_state(nid, NR_FILE_PAGES)), |
Christoph Lameter | 65ba55f | 2006-06-30 01:55:34 -0700 | [diff] [blame] | 124 | nid, K(node_page_state(nid, NR_FILE_MAPPED)), |
Christoph Lameter | f3dbd34 | 2006-06-30 01:55:36 -0700 | [diff] [blame] | 125 | nid, K(node_page_state(nid, NR_ANON_PAGES)), |
KOSAKI Motohiro | 4b02108 | 2009-09-21 17:01:33 -0700 | [diff] [blame] | 126 | nid, K(node_page_state(nid, NR_SHMEM)), |
KOSAKI Motohiro | c6a7f57 | 2009-09-21 17:01:32 -0700 | [diff] [blame] | 127 | nid, node_page_state(nid, NR_KERNEL_STACK) * |
| 128 | THREAD_SIZE / 1024, |
Christoph Lameter | df849a1 | 2006-06-30 01:55:38 -0700 | [diff] [blame] | 129 | nid, K(node_page_state(nid, NR_PAGETABLE)), |
Christoph Lameter | fd39fc8 | 2006-06-30 01:55:40 -0700 | [diff] [blame] | 130 | nid, K(node_page_state(nid, NR_UNSTABLE_NFS)), |
Christoph Lameter | d2c5e30 | 2006-06-30 01:55:41 -0700 | [diff] [blame] | 131 | nid, K(node_page_state(nid, NR_BOUNCE)), |
Miklos Szeredi | fc3ba69 | 2008-04-30 00:54:38 -0700 | [diff] [blame] | 132 | nid, K(node_page_state(nid, NR_WRITEBACK_TEMP)), |
Christoph Lameter | 972d1a7 | 2006-09-25 23:31:51 -0700 | [diff] [blame] | 133 | nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE) + |
| 134 | node_page_state(nid, NR_SLAB_UNRECLAIMABLE)), |
| 135 | nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE)), |
| 136 | nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | n += hugetlb_report_node_meminfo(nid, buf + n); |
| 138 | return n; |
| 139 | } |
| 140 | |
| 141 | #undef K |
| 142 | static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL); |
| 143 | |
Andi Kleen | 4a0b2b4 | 2008-07-01 18:48:41 +0200 | [diff] [blame] | 144 | static ssize_t node_read_numastat(struct sys_device * dev, |
| 145 | struct sysdev_attribute *attr, char * buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | return sprintf(buf, |
| 148 | "numa_hit %lu\n" |
| 149 | "numa_miss %lu\n" |
| 150 | "numa_foreign %lu\n" |
| 151 | "interleave_hit %lu\n" |
| 152 | "local_node %lu\n" |
| 153 | "other_node %lu\n", |
Christoph Lameter | ca889e6 | 2006-06-30 01:55:44 -0700 | [diff] [blame] | 154 | node_page_state(dev->id, NUMA_HIT), |
| 155 | node_page_state(dev->id, NUMA_MISS), |
| 156 | node_page_state(dev->id, NUMA_FOREIGN), |
| 157 | node_page_state(dev->id, NUMA_INTERLEAVE_HIT), |
| 158 | node_page_state(dev->id, NUMA_LOCAL), |
| 159 | node_page_state(dev->id, NUMA_OTHER)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | } |
| 161 | static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); |
| 162 | |
Michael Rubin | 2ac3903 | 2010-10-26 14:21:35 -0700 | [diff] [blame] | 163 | static ssize_t node_read_vmstat(struct sys_device *dev, |
| 164 | struct sysdev_attribute *attr, char *buf) |
| 165 | { |
| 166 | int nid = dev->id; |
| 167 | return sprintf(buf, |
| 168 | "nr_written %lu\n" |
| 169 | "nr_dirtied %lu\n", |
| 170 | node_page_state(nid, NR_WRITTEN), |
| 171 | node_page_state(nid, NR_DIRTIED)); |
| 172 | } |
| 173 | static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL); |
| 174 | |
Andi Kleen | 4a0b2b4 | 2008-07-01 18:48:41 +0200 | [diff] [blame] | 175 | static ssize_t node_read_distance(struct sys_device * dev, |
| 176 | struct sysdev_attribute *attr, char * buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | { |
| 178 | int nid = dev->id; |
| 179 | int len = 0; |
| 180 | int i; |
| 181 | |
David Rientjes | 12ee3c0 | 2010-03-10 14:50:21 -0800 | [diff] [blame] | 182 | /* |
| 183 | * buf is currently PAGE_SIZE in length and each node needs 4 chars |
| 184 | * at the most (distance + space or newline). |
| 185 | */ |
| 186 | BUILD_BUG_ON(MAX_NUMNODES * 4 > PAGE_SIZE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | |
| 188 | for_each_online_node(i) |
| 189 | len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i)); |
| 190 | |
| 191 | len += sprintf(buf + len, "\n"); |
| 192 | return len; |
| 193 | } |
| 194 | static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL); |
| 195 | |
Lee Schermerhorn | 9a305230 | 2009-12-14 17:58:25 -0800 | [diff] [blame] | 196 | #ifdef CONFIG_HUGETLBFS |
| 197 | /* |
| 198 | * hugetlbfs per node attributes registration interface: |
| 199 | * When/if hugetlb[fs] subsystem initializes [sometime after this module], |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 200 | * it will register its per node attributes for all online nodes with |
| 201 | * memory. It will also call register_hugetlbfs_with_node(), below, to |
Lee Schermerhorn | 9a305230 | 2009-12-14 17:58:25 -0800 | [diff] [blame] | 202 | * register its attribute registration functions with this node driver. |
| 203 | * Once these hooks have been initialized, the node driver will call into |
| 204 | * the hugetlb module to [un]register attributes for hot-plugged nodes. |
| 205 | */ |
| 206 | static node_registration_func_t __hugetlb_register_node; |
| 207 | static node_registration_func_t __hugetlb_unregister_node; |
| 208 | |
Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 209 | static inline bool hugetlb_register_node(struct node *node) |
Lee Schermerhorn | 9a305230 | 2009-12-14 17:58:25 -0800 | [diff] [blame] | 210 | { |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 211 | if (__hugetlb_register_node && |
Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 212 | node_state(node->sysdev.id, N_HIGH_MEMORY)) { |
Lee Schermerhorn | 9a305230 | 2009-12-14 17:58:25 -0800 | [diff] [blame] | 213 | __hugetlb_register_node(node); |
Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 214 | return true; |
| 215 | } |
| 216 | return false; |
Lee Schermerhorn | 9a305230 | 2009-12-14 17:58:25 -0800 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | static inline void hugetlb_unregister_node(struct node *node) |
| 220 | { |
| 221 | if (__hugetlb_unregister_node) |
| 222 | __hugetlb_unregister_node(node); |
| 223 | } |
| 224 | |
| 225 | void register_hugetlbfs_with_node(node_registration_func_t doregister, |
| 226 | node_registration_func_t unregister) |
| 227 | { |
| 228 | __hugetlb_register_node = doregister; |
| 229 | __hugetlb_unregister_node = unregister; |
| 230 | } |
| 231 | #else |
| 232 | static inline void hugetlb_register_node(struct node *node) {} |
| 233 | |
| 234 | static inline void hugetlb_unregister_node(struct node *node) {} |
| 235 | #endif |
| 236 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | |
| 238 | /* |
Robert P. J. Day | 405ae7d | 2007-02-17 19:13:42 +0100 | [diff] [blame] | 239 | * register_node - Setup a sysfs device for a node. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | * @num - Node number to use when creating the device. |
| 241 | * |
| 242 | * Initialize and register the node device. |
| 243 | */ |
Keiichiro Tokunaga | 4b45099 | 2005-05-08 21:28:53 +0900 | [diff] [blame] | 244 | int register_node(struct node *node, int num, struct node *parent) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | { |
| 246 | int error; |
| 247 | |
| 248 | node->sysdev.id = num; |
| 249 | node->sysdev.cls = &node_class; |
| 250 | error = sysdev_register(&node->sysdev); |
| 251 | |
| 252 | if (!error){ |
| 253 | sysdev_create_file(&node->sysdev, &attr_cpumap); |
Mike Travis | 39106dc | 2008-04-08 11:43:03 -0700 | [diff] [blame] | 254 | sysdev_create_file(&node->sysdev, &attr_cpulist); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | sysdev_create_file(&node->sysdev, &attr_meminfo); |
| 256 | sysdev_create_file(&node->sysdev, &attr_numastat); |
| 257 | sysdev_create_file(&node->sysdev, &attr_distance); |
Michael Rubin | 2ac3903 | 2010-10-26 14:21:35 -0700 | [diff] [blame] | 258 | sysdev_create_file(&node->sysdev, &attr_vmstat); |
Lee Schermerhorn | af936a1 | 2008-10-18 20:26:53 -0700 | [diff] [blame] | 259 | |
| 260 | scan_unevictable_register_node(node); |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 261 | |
Lee Schermerhorn | 9a305230 | 2009-12-14 17:58:25 -0800 | [diff] [blame] | 262 | hugetlb_register_node(node); |
Mel Gorman | ed4a6d7 | 2010-05-24 14:32:29 -0700 | [diff] [blame] | 263 | |
| 264 | compaction_register_node(node); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | } |
| 266 | return error; |
| 267 | } |
| 268 | |
Keiichiro Tokunaga | 4b45099 | 2005-05-08 21:28:53 +0900 | [diff] [blame] | 269 | /** |
| 270 | * unregister_node - unregister a node device |
| 271 | * @node: node going away |
| 272 | * |
| 273 | * Unregisters a node device @node. All the devices on the node must be |
| 274 | * unregistered before calling this function. |
| 275 | */ |
| 276 | void unregister_node(struct node *node) |
| 277 | { |
| 278 | sysdev_remove_file(&node->sysdev, &attr_cpumap); |
Mike Travis | 39106dc | 2008-04-08 11:43:03 -0700 | [diff] [blame] | 279 | sysdev_remove_file(&node->sysdev, &attr_cpulist); |
Keiichiro Tokunaga | 4b45099 | 2005-05-08 21:28:53 +0900 | [diff] [blame] | 280 | sysdev_remove_file(&node->sysdev, &attr_meminfo); |
| 281 | sysdev_remove_file(&node->sysdev, &attr_numastat); |
| 282 | sysdev_remove_file(&node->sysdev, &attr_distance); |
Michael Rubin | 2ac3903 | 2010-10-26 14:21:35 -0700 | [diff] [blame] | 283 | sysdev_remove_file(&node->sysdev, &attr_vmstat); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | |
Lee Schermerhorn | af936a1 | 2008-10-18 20:26:53 -0700 | [diff] [blame] | 285 | scan_unevictable_unregister_node(node); |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 286 | hugetlb_unregister_node(node); /* no-op, if memoryless node */ |
Lee Schermerhorn | af936a1 | 2008-10-18 20:26:53 -0700 | [diff] [blame] | 287 | |
Keiichiro Tokunaga | 4b45099 | 2005-05-08 21:28:53 +0900 | [diff] [blame] | 288 | sysdev_unregister(&node->sysdev); |
| 289 | } |
| 290 | |
Yasunori Goto | 0fc4415 | 2006-06-27 02:53:38 -0700 | [diff] [blame] | 291 | struct node node_devices[MAX_NUMNODES]; |
| 292 | |
KAMEZAWA Hiroyuki | 76b67ed | 2006-06-27 02:53:41 -0700 | [diff] [blame] | 293 | /* |
| 294 | * register cpu under node |
| 295 | */ |
| 296 | int register_cpu_under_node(unsigned int cpu, unsigned int nid) |
| 297 | { |
Alex Chiang | 1830794 | 2009-12-14 17:59:08 -0800 | [diff] [blame] | 298 | int ret; |
Alex Chiang | f8246f3 | 2009-12-14 17:59:06 -0800 | [diff] [blame] | 299 | struct sys_device *obj; |
KAMEZAWA Hiroyuki | 76b67ed | 2006-06-27 02:53:41 -0700 | [diff] [blame] | 300 | |
Alex Chiang | f8246f3 | 2009-12-14 17:59:06 -0800 | [diff] [blame] | 301 | if (!node_online(nid)) |
| 302 | return 0; |
| 303 | |
| 304 | obj = get_cpu_sysdev(cpu); |
| 305 | if (!obj) |
| 306 | return 0; |
| 307 | |
Alex Chiang | 1830794 | 2009-12-14 17:59:08 -0800 | [diff] [blame] | 308 | ret = sysfs_create_link(&node_devices[nid].sysdev.kobj, |
Alex Chiang | f8246f3 | 2009-12-14 17:59:06 -0800 | [diff] [blame] | 309 | &obj->kobj, |
| 310 | kobject_name(&obj->kobj)); |
Alex Chiang | 1830794 | 2009-12-14 17:59:08 -0800 | [diff] [blame] | 311 | if (ret) |
| 312 | return ret; |
| 313 | |
| 314 | return sysfs_create_link(&obj->kobj, |
| 315 | &node_devices[nid].sysdev.kobj, |
| 316 | kobject_name(&node_devices[nid].sysdev.kobj)); |
KAMEZAWA Hiroyuki | 76b67ed | 2006-06-27 02:53:41 -0700 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | int unregister_cpu_under_node(unsigned int cpu, unsigned int nid) |
| 320 | { |
Alex Chiang | b9d52da | 2009-12-14 17:59:07 -0800 | [diff] [blame] | 321 | struct sys_device *obj; |
| 322 | |
| 323 | if (!node_online(nid)) |
| 324 | return 0; |
| 325 | |
| 326 | obj = get_cpu_sysdev(cpu); |
| 327 | if (!obj) |
| 328 | return 0; |
| 329 | |
| 330 | sysfs_remove_link(&node_devices[nid].sysdev.kobj, |
| 331 | kobject_name(&obj->kobj)); |
Alex Chiang | 1830794 | 2009-12-14 17:59:08 -0800 | [diff] [blame] | 332 | sysfs_remove_link(&obj->kobj, |
| 333 | kobject_name(&node_devices[nid].sysdev.kobj)); |
Alex Chiang | b9d52da | 2009-12-14 17:59:07 -0800 | [diff] [blame] | 334 | |
KAMEZAWA Hiroyuki | 76b67ed | 2006-06-27 02:53:41 -0700 | [diff] [blame] | 335 | return 0; |
| 336 | } |
| 337 | |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 338 | #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE |
| 339 | #define page_initialized(page) (page->lru.next) |
| 340 | |
| 341 | static int get_nid_for_pfn(unsigned long pfn) |
| 342 | { |
| 343 | struct page *page; |
| 344 | |
| 345 | if (!pfn_valid_within(pfn)) |
| 346 | return -1; |
| 347 | page = pfn_to_page(pfn); |
| 348 | if (!page_initialized(page)) |
| 349 | return -1; |
| 350 | return pfn_to_nid(pfn); |
| 351 | } |
| 352 | |
| 353 | /* register memory section under specified node if it spans that node */ |
| 354 | int register_mem_sect_under_node(struct memory_block *mem_blk, int nid) |
| 355 | { |
Alex Chiang | dee5d0d | 2009-12-14 17:59:05 -0800 | [diff] [blame] | 356 | int ret; |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 357 | unsigned long pfn, sect_start_pfn, sect_end_pfn; |
| 358 | |
| 359 | if (!mem_blk) |
| 360 | return -EFAULT; |
| 361 | if (!node_online(nid)) |
| 362 | return 0; |
| 363 | sect_start_pfn = section_nr_to_pfn(mem_blk->phys_index); |
| 364 | sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1; |
| 365 | for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) { |
| 366 | int page_nid; |
| 367 | |
| 368 | page_nid = get_nid_for_pfn(pfn); |
| 369 | if (page_nid < 0) |
| 370 | continue; |
| 371 | if (page_nid != nid) |
| 372 | continue; |
Alex Chiang | dee5d0d | 2009-12-14 17:59:05 -0800 | [diff] [blame] | 373 | ret = sysfs_create_link_nowarn(&node_devices[nid].sysdev.kobj, |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 374 | &mem_blk->sysdev.kobj, |
| 375 | kobject_name(&mem_blk->sysdev.kobj)); |
Alex Chiang | dee5d0d | 2009-12-14 17:59:05 -0800 | [diff] [blame] | 376 | if (ret) |
| 377 | return ret; |
| 378 | |
| 379 | return sysfs_create_link_nowarn(&mem_blk->sysdev.kobj, |
| 380 | &node_devices[nid].sysdev.kobj, |
| 381 | kobject_name(&node_devices[nid].sysdev.kobj)); |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 382 | } |
| 383 | /* mem section does not span the specified node */ |
| 384 | return 0; |
| 385 | } |
| 386 | |
| 387 | /* unregister memory section under all nodes that it spans */ |
| 388 | int unregister_mem_sect_under_nodes(struct memory_block *mem_blk) |
| 389 | { |
David Rientjes | 9ae49fa | 2009-12-14 17:59:46 -0800 | [diff] [blame] | 390 | NODEMASK_ALLOC(nodemask_t, unlinked_nodes, GFP_KERNEL); |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 391 | unsigned long pfn, sect_start_pfn, sect_end_pfn; |
| 392 | |
David Rientjes | 9ae49fa | 2009-12-14 17:59:46 -0800 | [diff] [blame] | 393 | if (!mem_blk) { |
| 394 | NODEMASK_FREE(unlinked_nodes); |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 395 | return -EFAULT; |
David Rientjes | 9ae49fa | 2009-12-14 17:59:46 -0800 | [diff] [blame] | 396 | } |
| 397 | if (!unlinked_nodes) |
| 398 | return -ENOMEM; |
| 399 | nodes_clear(*unlinked_nodes); |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 400 | sect_start_pfn = section_nr_to_pfn(mem_blk->phys_index); |
| 401 | sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1; |
| 402 | for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) { |
Roel Kluin | 4750498 | 2009-03-10 12:55:45 -0700 | [diff] [blame] | 403 | int nid; |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 404 | |
| 405 | nid = get_nid_for_pfn(pfn); |
| 406 | if (nid < 0) |
| 407 | continue; |
| 408 | if (!node_online(nid)) |
| 409 | continue; |
David Rientjes | 9ae49fa | 2009-12-14 17:59:46 -0800 | [diff] [blame] | 410 | if (node_test_and_set(nid, *unlinked_nodes)) |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 411 | continue; |
| 412 | sysfs_remove_link(&node_devices[nid].sysdev.kobj, |
| 413 | kobject_name(&mem_blk->sysdev.kobj)); |
Alex Chiang | dee5d0d | 2009-12-14 17:59:05 -0800 | [diff] [blame] | 414 | sysfs_remove_link(&mem_blk->sysdev.kobj, |
| 415 | kobject_name(&node_devices[nid].sysdev.kobj)); |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 416 | } |
David Rientjes | 9ae49fa | 2009-12-14 17:59:46 -0800 | [diff] [blame] | 417 | NODEMASK_FREE(unlinked_nodes); |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 418 | return 0; |
| 419 | } |
| 420 | |
| 421 | static int link_mem_sections(int nid) |
| 422 | { |
| 423 | unsigned long start_pfn = NODE_DATA(nid)->node_start_pfn; |
| 424 | unsigned long end_pfn = start_pfn + NODE_DATA(nid)->node_spanned_pages; |
| 425 | unsigned long pfn; |
Robin Holt | 63d027a | 2010-09-29 14:00:56 -0500 | [diff] [blame] | 426 | struct memory_block *mem_blk = NULL; |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 427 | int err = 0; |
| 428 | |
| 429 | for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) { |
| 430 | unsigned long section_nr = pfn_to_section_nr(pfn); |
| 431 | struct mem_section *mem_sect; |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 432 | int ret; |
| 433 | |
| 434 | if (!present_section_nr(section_nr)) |
| 435 | continue; |
| 436 | mem_sect = __nr_to_section(section_nr); |
Robin Holt | 63d027a | 2010-09-29 14:00:56 -0500 | [diff] [blame] | 437 | mem_blk = find_memory_block_hinted(mem_sect, mem_blk); |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 438 | ret = register_mem_sect_under_node(mem_blk, nid); |
| 439 | if (!err) |
| 440 | err = ret; |
| 441 | |
| 442 | /* discard ref obtained in find_memory_block() */ |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 443 | } |
Robin Holt | 63d027a | 2010-09-29 14:00:56 -0500 | [diff] [blame] | 444 | |
| 445 | if (mem_blk) |
| 446 | kobject_put(&mem_blk->sysdev.kobj); |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 447 | return err; |
| 448 | } |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 449 | |
Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 450 | #ifdef CONFIG_HUGETLBFS |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 451 | /* |
| 452 | * Handle per node hstate attribute [un]registration on transistions |
| 453 | * to/from memoryless state. |
| 454 | */ |
Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 455 | static void node_hugetlb_work(struct work_struct *work) |
| 456 | { |
| 457 | struct node *node = container_of(work, struct node, node_work); |
| 458 | |
| 459 | /* |
| 460 | * We only get here when a node transitions to/from memoryless state. |
| 461 | * We can detect which transition occurred by examining whether the |
| 462 | * node has memory now. hugetlb_register_node() already check this |
| 463 | * so we try to register the attributes. If that fails, then the |
| 464 | * node has transitioned to memoryless, try to unregister the |
| 465 | * attributes. |
| 466 | */ |
| 467 | if (!hugetlb_register_node(node)) |
| 468 | hugetlb_unregister_node(node); |
| 469 | } |
| 470 | |
| 471 | static void init_node_hugetlb_work(int nid) |
| 472 | { |
| 473 | INIT_WORK(&node_devices[nid].node_work, node_hugetlb_work); |
| 474 | } |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 475 | |
| 476 | static int node_memory_callback(struct notifier_block *self, |
| 477 | unsigned long action, void *arg) |
| 478 | { |
| 479 | struct memory_notify *mnb = arg; |
| 480 | int nid = mnb->status_change_nid; |
| 481 | |
| 482 | switch (action) { |
Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 483 | case MEM_ONLINE: |
| 484 | case MEM_OFFLINE: |
| 485 | /* |
| 486 | * offload per node hstate [un]registration to a work thread |
| 487 | * when transitioning to/from memoryless state. |
| 488 | */ |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 489 | if (nid != NUMA_NO_NODE) |
Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 490 | schedule_work(&node_devices[nid].node_work); |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 491 | break; |
Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 492 | |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 493 | case MEM_GOING_ONLINE: |
| 494 | case MEM_GOING_OFFLINE: |
| 495 | case MEM_CANCEL_ONLINE: |
| 496 | case MEM_CANCEL_OFFLINE: |
| 497 | default: |
| 498 | break; |
| 499 | } |
| 500 | |
| 501 | return NOTIFY_OK; |
| 502 | } |
Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 503 | #endif /* CONFIG_HUGETLBFS */ |
| 504 | #else /* !CONFIG_MEMORY_HOTPLUG_SPARSE */ |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 505 | |
Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 506 | static int link_mem_sections(int nid) { return 0; } |
| 507 | #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ |
| 508 | |
| 509 | #if !defined(CONFIG_MEMORY_HOTPLUG_SPARSE) || \ |
| 510 | !defined(CONFIG_HUGETLBFS) |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 511 | static inline int node_memory_callback(struct notifier_block *self, |
| 512 | unsigned long action, void *arg) |
| 513 | { |
| 514 | return NOTIFY_OK; |
| 515 | } |
Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 516 | |
| 517 | static void init_node_hugetlb_work(int nid) { } |
| 518 | |
| 519 | #endif |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 520 | |
Yasunori Goto | 0fc4415 | 2006-06-27 02:53:38 -0700 | [diff] [blame] | 521 | int register_one_node(int nid) |
| 522 | { |
| 523 | int error = 0; |
KAMEZAWA Hiroyuki | 76b67ed | 2006-06-27 02:53:41 -0700 | [diff] [blame] | 524 | int cpu; |
Yasunori Goto | 0fc4415 | 2006-06-27 02:53:38 -0700 | [diff] [blame] | 525 | |
| 526 | if (node_online(nid)) { |
| 527 | int p_node = parent_node(nid); |
| 528 | struct node *parent = NULL; |
| 529 | |
| 530 | if (p_node != nid) |
| 531 | parent = &node_devices[p_node]; |
| 532 | |
| 533 | error = register_node(&node_devices[nid], nid, parent); |
KAMEZAWA Hiroyuki | 76b67ed | 2006-06-27 02:53:41 -0700 | [diff] [blame] | 534 | |
| 535 | /* link cpu under this node */ |
| 536 | for_each_present_cpu(cpu) { |
| 537 | if (cpu_to_node(cpu) == nid) |
| 538 | register_cpu_under_node(cpu, nid); |
| 539 | } |
Gary Hade | c04fc58 | 2009-01-06 14:39:14 -0800 | [diff] [blame] | 540 | |
| 541 | /* link memory sections under this node */ |
| 542 | error = link_mem_sections(nid); |
Lee Schermerhorn | 39da08c | 2009-12-14 17:58:36 -0800 | [diff] [blame] | 543 | |
| 544 | /* initialize work queue for memory hot plug */ |
| 545 | init_node_hugetlb_work(nid); |
Yasunori Goto | 0fc4415 | 2006-06-27 02:53:38 -0700 | [diff] [blame] | 546 | } |
| 547 | |
| 548 | return error; |
| 549 | |
| 550 | } |
| 551 | |
| 552 | void unregister_one_node(int nid) |
| 553 | { |
| 554 | unregister_node(&node_devices[nid]); |
| 555 | } |
| 556 | |
Lee Schermerhorn | bde631a | 2007-10-16 01:26:27 -0700 | [diff] [blame] | 557 | /* |
| 558 | * node states attributes |
| 559 | */ |
| 560 | |
| 561 | static ssize_t print_nodes_state(enum node_states state, char *buf) |
| 562 | { |
| 563 | int n; |
| 564 | |
| 565 | n = nodelist_scnprintf(buf, PAGE_SIZE, node_states[state]); |
| 566 | if (n > 0 && PAGE_SIZE > n + 1) { |
| 567 | *(buf + n++) = '\n'; |
| 568 | *(buf + n++) = '\0'; |
| 569 | } |
| 570 | return n; |
| 571 | } |
| 572 | |
Andi Kleen | b15f562 | 2010-01-05 12:47:59 +0100 | [diff] [blame] | 573 | struct node_attr { |
| 574 | struct sysdev_class_attribute attr; |
| 575 | enum node_states state; |
| 576 | }; |
| 577 | |
| 578 | static ssize_t show_node_state(struct sysdev_class *class, |
| 579 | struct sysdev_class_attribute *attr, char *buf) |
Lee Schermerhorn | bde631a | 2007-10-16 01:26:27 -0700 | [diff] [blame] | 580 | { |
Andi Kleen | b15f562 | 2010-01-05 12:47:59 +0100 | [diff] [blame] | 581 | struct node_attr *na = container_of(attr, struct node_attr, attr); |
| 582 | return print_nodes_state(na->state, buf); |
Lee Schermerhorn | bde631a | 2007-10-16 01:26:27 -0700 | [diff] [blame] | 583 | } |
| 584 | |
Andi Kleen | b15f562 | 2010-01-05 12:47:59 +0100 | [diff] [blame] | 585 | #define _NODE_ATTR(name, state) \ |
| 586 | { _SYSDEV_CLASS_ATTR(name, 0444, show_node_state, NULL), state } |
Lee Schermerhorn | bde631a | 2007-10-16 01:26:27 -0700 | [diff] [blame] | 587 | |
Andi Kleen | b15f562 | 2010-01-05 12:47:59 +0100 | [diff] [blame] | 588 | static struct node_attr node_state_attr[] = { |
| 589 | _NODE_ATTR(possible, N_POSSIBLE), |
| 590 | _NODE_ATTR(online, N_ONLINE), |
| 591 | _NODE_ATTR(has_normal_memory, N_NORMAL_MEMORY), |
| 592 | _NODE_ATTR(has_cpu, N_CPU), |
Lee Schermerhorn | bde631a | 2007-10-16 01:26:27 -0700 | [diff] [blame] | 593 | #ifdef CONFIG_HIGHMEM |
Andi Kleen | b15f562 | 2010-01-05 12:47:59 +0100 | [diff] [blame] | 594 | _NODE_ATTR(has_high_memory, N_HIGH_MEMORY), |
Lee Schermerhorn | bde631a | 2007-10-16 01:26:27 -0700 | [diff] [blame] | 595 | #endif |
Lee Schermerhorn | bde631a | 2007-10-16 01:26:27 -0700 | [diff] [blame] | 596 | }; |
| 597 | |
Andi Kleen | 3701cde | 2010-01-05 12:48:04 +0100 | [diff] [blame] | 598 | static struct sysdev_class_attribute *node_state_attrs[] = { |
| 599 | &node_state_attr[0].attr, |
| 600 | &node_state_attr[1].attr, |
| 601 | &node_state_attr[2].attr, |
| 602 | &node_state_attr[3].attr, |
| 603 | #ifdef CONFIG_HIGHMEM |
| 604 | &node_state_attr[4].attr, |
| 605 | #endif |
| 606 | NULL |
| 607 | }; |
Lee Schermerhorn | bde631a | 2007-10-16 01:26:27 -0700 | [diff] [blame] | 608 | |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 609 | #define NODE_CALLBACK_PRI 2 /* lower than SLAB */ |
Keiichiro Tokunaga | 4b45099 | 2005-05-08 21:28:53 +0900 | [diff] [blame] | 610 | static int __init register_node_type(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 611 | { |
Lee Schermerhorn | bde631a | 2007-10-16 01:26:27 -0700 | [diff] [blame] | 612 | int ret; |
| 613 | |
Andi Kleen | 3701cde | 2010-01-05 12:48:04 +0100 | [diff] [blame] | 614 | BUILD_BUG_ON(ARRAY_SIZE(node_state_attr) != NR_NODE_STATES); |
| 615 | BUILD_BUG_ON(ARRAY_SIZE(node_state_attrs)-1 != NR_NODE_STATES); |
| 616 | |
Lee Schermerhorn | bde631a | 2007-10-16 01:26:27 -0700 | [diff] [blame] | 617 | ret = sysdev_class_register(&node_class); |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 618 | if (!ret) { |
Lee Schermerhorn | 4faf8d9 | 2009-12-14 17:58:35 -0800 | [diff] [blame] | 619 | hotplug_memory_notifier(node_memory_callback, |
| 620 | NODE_CALLBACK_PRI); |
| 621 | } |
Lee Schermerhorn | bde631a | 2007-10-16 01:26:27 -0700 | [diff] [blame] | 622 | |
| 623 | /* |
| 624 | * Note: we're not going to unregister the node class if we fail |
| 625 | * to register the node state class attribute files. |
| 626 | */ |
| 627 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 628 | } |
| 629 | postcore_initcall(register_node_type); |