aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/node.c')
-rw-r--r--drivers/base/node.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 1fe5536d404f..f502711d28db 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -173,6 +173,43 @@ static ssize_t node_read_distance(struct sys_device * dev,
173} 173}
174static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL); 174static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL);
175 175
176#ifdef CONFIG_HUGETLBFS
177/*
178 * hugetlbfs per node attributes registration interface:
179 * When/if hugetlb[fs] subsystem initializes [sometime after this module],
180 * it will register its per node attributes for all nodes online at that
181 * time. It will also call register_hugetlbfs_with_node(), below, to
182 * register its attribute registration functions with this node driver.
183 * Once these hooks have been initialized, the node driver will call into
184 * the hugetlb module to [un]register attributes for hot-plugged nodes.
185 */
186static node_registration_func_t __hugetlb_register_node;
187static node_registration_func_t __hugetlb_unregister_node;
188
189static inline void hugetlb_register_node(struct node *node)
190{
191 if (__hugetlb_register_node)
192 __hugetlb_register_node(node);
193}
194
195static inline void hugetlb_unregister_node(struct node *node)
196{
197 if (__hugetlb_unregister_node)
198 __hugetlb_unregister_node(node);
199}
200
201void register_hugetlbfs_with_node(node_registration_func_t doregister,
202 node_registration_func_t unregister)
203{
204 __hugetlb_register_node = doregister;
205 __hugetlb_unregister_node = unregister;
206}
207#else
208static inline void hugetlb_register_node(struct node *node) {}
209
210static inline void hugetlb_unregister_node(struct node *node) {}
211#endif
212
176 213
177/* 214/*
178 * register_node - Setup a sysfs device for a node. 215 * register_node - Setup a sysfs device for a node.
@@ -196,6 +233,7 @@ int register_node(struct node *node, int num, struct node *parent)
196 sysdev_create_file(&node->sysdev, &attr_distance); 233 sysdev_create_file(&node->sysdev, &attr_distance);
197 234
198 scan_unevictable_register_node(node); 235 scan_unevictable_register_node(node);
236 hugetlb_register_node(node);
199 } 237 }
200 return error; 238 return error;
201} 239}
@@ -216,6 +254,7 @@ void unregister_node(struct node *node)
216 sysdev_remove_file(&node->sysdev, &attr_distance); 254 sysdev_remove_file(&node->sysdev, &attr_distance);
217 255
218 scan_unevictable_unregister_node(node); 256 scan_unevictable_unregister_node(node);
257 hugetlb_unregister_node(node);
219 258
220 sysdev_unregister(&node->sysdev); 259 sysdev_unregister(&node->sysdev);
221} 260}