2 * include/linux/node.h - generic node definition
4 * This is mainly for topological representation. We define the
5 * basic 'struct node' here, which can be embedded in per-arch
6 * definitions of processors.
8 * Basic handling of the devices is done in drivers/base/node.c
9 * and system devices are handled in drivers/base/sys.c.
11 * Nodes are exported via driverfs in the class/node/devices/
14 #ifndef _LINUX_NODE_H_
15 #define _LINUX_NODE_H_
17 #include <linux/device.h>
18 #include <linux/cpumask.h>
19 #include <linux/workqueue.h>
24 #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
25 struct work_struct node_work;
30 extern struct node *node_devices[];
31 typedef void (*node_registration_func_t)(struct node *);
33 #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_NUMA)
34 extern int link_mem_sections(int nid, unsigned long start_pfn, unsigned long nr_pages);
36 static inline int link_mem_sections(int nid, unsigned long start_pfn, unsigned long nr_pages)
42 extern void unregister_node(struct node *node);
44 /* Core of the node registration - only memory hotplug should use this */
45 extern int __register_one_node(int nid);
47 /* Registers an online node */
48 static inline int register_one_node(int nid)
52 if (node_online(nid)) {
53 struct pglist_data *pgdat = NODE_DATA(nid);
55 error = __register_one_node(nid);
58 /* link memory sections under this node */
59 error = link_mem_sections(nid, pgdat->node_start_pfn, pgdat->node_spanned_pages);
65 extern void unregister_one_node(int nid);
66 extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
67 extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
68 extern int register_mem_sect_under_node(struct memory_block *mem_blk,
70 extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
71 unsigned long phys_index);
73 #ifdef CONFIG_HUGETLBFS
74 extern void register_hugetlbfs_with_node(node_registration_func_t doregister,
75 node_registration_func_t unregister);
78 static inline int __register_one_node(int nid)
82 static inline int register_one_node(int nid)
86 static inline int unregister_one_node(int nid)
90 static inline int register_cpu_under_node(unsigned int cpu, unsigned int nid)
94 static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
98 static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
103 static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
104 unsigned long phys_index)
109 static inline void register_hugetlbfs_with_node(node_registration_func_t reg,
110 node_registration_func_t unreg)
115 #define to_node(device) container_of(device, struct node, dev)
117 #endif /* _LINUX_NODE_H_ */