2005-04-17 05:20:36 +07: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 05:48:43 +07:00
|
|
|
#include <linux/device.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <linux/cpumask.h>
|
2009-12-15 08:58:36 +07:00
|
|
|
#include <linux/workqueue.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
struct node {
|
2011-12-22 05:48:43 +07:00
|
|
|
struct device dev;
|
2009-12-15 08:58:36 +07:00
|
|
|
|
|
|
|
#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
|
|
|
|
struct work_struct node_work;
|
|
|
|
#endif
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
2009-01-07 05:39:14 +07:00
|
|
|
struct memory_block;
|
2012-12-12 07:00:56 +07:00
|
|
|
extern struct node *node_devices[];
|
2009-12-15 08:58:25 +07:00
|
|
|
typedef void (*node_registration_func_t)(struct node *);
|
2006-06-27 16:53:38 +07:00
|
|
|
|
2017-07-07 05:37:49 +07:00
|
|
|
#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_NUMA)
|
|
|
|
extern int link_mem_sections(int nid, unsigned long start_pfn, unsigned long nr_pages);
|
|
|
|
#else
|
|
|
|
static inline int link_mem_sections(int nid, unsigned long start_pfn, unsigned long nr_pages)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-05-08 19:28:53 +07:00
|
|
|
extern void unregister_node(struct node *node);
|
2006-08-27 15:23:52 +07:00
|
|
|
#ifdef CONFIG_NUMA
|
2017-07-07 05:37:49 +07:00
|
|
|
/* Core of the node registration - only memory hotplug should use this */
|
|
|
|
extern int __register_one_node(int nid);
|
|
|
|
|
|
|
|
/* Registers an online node */
|
|
|
|
static inline int register_one_node(int nid)
|
|
|
|
{
|
|
|
|
int error = 0;
|
|
|
|
|
|
|
|
if (node_online(nid)) {
|
|
|
|
struct pglist_data *pgdat = NODE_DATA(nid);
|
|
|
|
|
|
|
|
error = __register_one_node(nid);
|
|
|
|
if (error)
|
|
|
|
return error;
|
|
|
|
/* link memory sections under this node */
|
|
|
|
error = link_mem_sections(nid, pgdat->node_start_pfn, pgdat->node_spanned_pages);
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2006-06-27 16:53:38 +07:00
|
|
|
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 16:53:41 +07: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 05:39:14 +07:00
|
|
|
extern int register_mem_sect_under_node(struct memory_block *mem_blk,
|
|
|
|
int nid);
|
2011-01-20 23:44:29 +07:00
|
|
|
extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
|
|
|
|
unsigned long phys_index);
|
2009-12-15 08:58:25 +07: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 16:53:41 +07:00
|
|
|
#else
|
2017-07-07 05:37:49 +07:00
|
|
|
static inline int __register_one_node(int nid)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2006-08-27 15:23:52 +07: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 16:53:41 +07: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 05:39:14 +07:00
|
|
|
static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
|
|
|
|
int nid)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2011-01-20 23:44:29 +07:00
|
|
|
static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk,
|
|
|
|
unsigned long phys_index)
|
2009-01-07 05:39:14 +07:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2009-12-15 08:58:25 +07: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 16:53:41 +07:00
|
|
|
#endif
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2011-12-22 05:48:43 +07:00
|
|
|
#define to_node(device) container_of(device, struct node, dev)
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#endif /* _LINUX_NODE_H_ */
|