2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* include/linux/node.h - generic node definition
|
|
|
|
*
|
|
|
|
* This is mainly for topological representation. We define the
|
|
|
|
* basic 'struct node' here, which can be embedded in per-arch
|
|
|
|
* definitions of processors.
|
|
|
|
*
|
|
|
|
* Basic handling of the devices is done in drivers/base/node.c
|
|
|
|
* and system devices are handled in drivers/base/sys.c.
|
|
|
|
*
|
|
|
|
* Nodes are exported via driverfs in the class/node/devices/
|
|
|
|
* directory.
|
|
|
|
*/
|
|
|
|
#ifndef _LINUX_NODE_H_
|
|
|
|
#define _LINUX_NODE_H_
|
|
|
|
|
2011-12-22 06:48:43 +08:00
|
|
|
#include <linux/device.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/cpumask.h>
|
2009-12-15 09:58:36 +08:00
|
|
|
#include <linux/workqueue.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
struct node {
|
2011-12-22 06:48:43 +08:00
|
|
|
struct device dev;
|
2009-12-15 09:58:36 +08:00
|
|
|
|
|
|
|
#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
|
|
|
|
struct work_struct node_work;
|
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2009-01-07 06:39:14 +08:00
|
|
|
struct memory_block;
|
2012-12-12 08:00:56 +08:00
|
|
|
extern struct node *node_devices[];
|
2009-12-15 09:58:25 +08:00
|
|
|
typedef void (*node_registration_func_t)(struct node *);
|
2006-06-27 17:53:38 +08:00
|
|
|
|
2005-05-08 20:28:53 +08:00
|
|
|
extern void unregister_node(struct node *node);
|
2006-08-27 16:23:52 +08:00
|
|
|
#ifdef CONFIG_NUMA
|
2006-06-27 17:53:38 +08:00
|
|
|
extern int register_one_node(int nid);
|
|
|
|
extern void unregister_one_node(int nid);
|
[PATCH] node hotplug: register cpu: remove node struct
With Goto-san's patch, we can add new pgdat/node at runtime. I'm now
considering node-hot-add with cpu + memory on ACPI.
I found acpi container, which describes node, could evaluate cpu before
memory. This means cpu-hot-add occurs before memory hot add.
In most part, cpu-hot-add doesn't depend on node hot add. But register_cpu(),
which creates symbolic link from node to cpu, requires that node should be
onlined before register_cpu(). When a node is onlined, its pgdat should be
there.
This patch-set holds off creating symbolic link from node to cpu
until node is onlined.
This removes node arguments from register_cpu().
Now, register_cpu() requires 'struct node' as its argument. But the array of
struct node is now unified in driver/base/node.c now (By Goto's node hotplug
patch). We can get struct node in generic way. So, this argument is not
necessary now.
This patch also guarantees add cpu under node only when node is onlined. It
is necessary for node-hot-add vs. cpu-hot-add patch following this.
Moreover, register_cpu calculates cpu->node_id by cpu_to_node() without regard
to its 'struct node *root' argument. This patch removes it.
Also modify callers of register_cpu()/unregister_cpu, whose args are changed
by register-cpu-remove-node-struct patch.
[Brice.Goglin@ens-lyon.org: fix it]
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Brice Goglin <Brice.Goglin@ens-lyon.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-27 17:53:41 +08:00
|
|
|
extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
|
|
|
|
extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
|
2009-01-07 06:39:14 +08:00
|
|
|
extern int register_mem_sect_under_node(struct memory_block *mem_blk,
|
|
|
|
int nid);
|
2011-01-21 00:44:29 +08:00
|
|
|
extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
|
|
|
|
unsigned long phys_index);
|
2009-12-15 09:58:25 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_HUGETLBFS
|
|
|
|
extern void register_hugetlbfs_with_node(node_registration_func_t doregister,
|
|
|
|
node_registration_func_t unregister);
|
|
|
|
#endif
|
[PATCH] node hotplug: register cpu: remove node struct
With Goto-san's patch, we can add new pgdat/node at runtime. I'm now
considering node-hot-add with cpu + memory on ACPI.
I found acpi container, which describes node, could evaluate cpu before
memory. This means cpu-hot-add occurs before memory hot add.
In most part, cpu-hot-add doesn't depend on node hot add. But register_cpu(),
which creates symbolic link from node to cpu, requires that node should be
onlined before register_cpu(). When a node is onlined, its pgdat should be
there.
This patch-set holds off creating symbolic link from node to cpu
until node is onlined.
This removes node arguments from register_cpu().
Now, register_cpu() requires 'struct node' as its argument. But the array of
struct node is now unified in driver/base/node.c now (By Goto's node hotplug
patch). We can get struct node in generic way. So, this argument is not
necessary now.
This patch also guarantees add cpu under node only when node is onlined. It
is necessary for node-hot-add vs. cpu-hot-add patch following this.
Moreover, register_cpu calculates cpu->node_id by cpu_to_node() without regard
to its 'struct node *root' argument. This patch removes it.
Also modify callers of register_cpu()/unregister_cpu, whose args are changed
by register-cpu-remove-node-struct patch.
[Brice.Goglin@ens-lyon.org: fix it]
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Brice Goglin <Brice.Goglin@ens-lyon.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-27 17:53:41 +08:00
|
|
|
#else
|
2006-08-27 16:23:52 +08:00
|
|
|
static inline int register_one_node(int nid)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static inline int unregister_one_node(int nid)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
[PATCH] node hotplug: register cpu: remove node struct
With Goto-san's patch, we can add new pgdat/node at runtime. I'm now
considering node-hot-add with cpu + memory on ACPI.
I found acpi container, which describes node, could evaluate cpu before
memory. This means cpu-hot-add occurs before memory hot add.
In most part, cpu-hot-add doesn't depend on node hot add. But register_cpu(),
which creates symbolic link from node to cpu, requires that node should be
onlined before register_cpu(). When a node is onlined, its pgdat should be
there.
This patch-set holds off creating symbolic link from node to cpu
until node is onlined.
This removes node arguments from register_cpu().
Now, register_cpu() requires 'struct node' as its argument. But the array of
struct node is now unified in driver/base/node.c now (By Goto's node hotplug
patch). We can get struct node in generic way. So, this argument is not
necessary now.
This patch also guarantees add cpu under node only when node is onlined. It
is necessary for node-hot-add vs. cpu-hot-add patch following this.
Moreover, register_cpu calculates cpu->node_id by cpu_to_node() without regard
to its 'struct node *root' argument. This patch removes it.
Also modify callers of register_cpu()/unregister_cpu, whose args are changed
by register-cpu-remove-node-struct patch.
[Brice.Goglin@ens-lyon.org: fix it]
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Brice Goglin <Brice.Goglin@ens-lyon.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-27 17:53:41 +08:00
|
|
|
static inline int register_cpu_under_node(unsigned int cpu, unsigned int nid)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2009-01-07 06:39:14 +08:00
|
|
|
static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
|
|
|
|
int nid)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2011-01-21 00:44:29 +08:00
|
|
|
static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
|
|
|
|
unsigned long phys_index)
|
2009-01-07 06:39:14 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2009-12-15 09:58:25 +08:00
|
|
|
|
|
|
|
static inline void register_hugetlbfs_with_node(node_registration_func_t reg,
|
|
|
|
node_registration_func_t unreg)
|
|
|
|
{
|
|
|
|
}
|
[PATCH] node hotplug: register cpu: remove node struct
With Goto-san's patch, we can add new pgdat/node at runtime. I'm now
considering node-hot-add with cpu + memory on ACPI.
I found acpi container, which describes node, could evaluate cpu before
memory. This means cpu-hot-add occurs before memory hot add.
In most part, cpu-hot-add doesn't depend on node hot add. But register_cpu(),
which creates symbolic link from node to cpu, requires that node should be
onlined before register_cpu(). When a node is onlined, its pgdat should be
there.
This patch-set holds off creating symbolic link from node to cpu
until node is onlined.
This removes node arguments from register_cpu().
Now, register_cpu() requires 'struct node' as its argument. But the array of
struct node is now unified in driver/base/node.c now (By Goto's node hotplug
patch). We can get struct node in generic way. So, this argument is not
necessary now.
This patch also guarantees add cpu under node only when node is onlined. It
is necessary for node-hot-add vs. cpu-hot-add patch following this.
Moreover, register_cpu calculates cpu->node_id by cpu_to_node() without regard
to its 'struct node *root' argument. This patch removes it.
Also modify callers of register_cpu()/unregister_cpu, whose args are changed
by register-cpu-remove-node-struct patch.
[Brice.Goglin@ens-lyon.org: fix it]
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Brice Goglin <Brice.Goglin@ens-lyon.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-27 17:53:41 +08:00
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2011-12-22 06:48:43 +08:00
|
|
|
#define to_node(device) container_of(device, struct node, dev)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#endif /* _LINUX_NODE_H_ */
|