Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76b67ed9 authored by KAMEZAWA Hiroyuki's avatar KAMEZAWA Hiroyuki Committed by Linus Torvalds
Browse files

[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: default avatarKAMEZAWA 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: default avatarBrice Goglin <Brice.Goglin@ens-lyon.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent dd0932d9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -481,7 +481,7 @@ register_cpus(void)
		struct cpu *p = kzalloc(sizeof(*p), GFP_KERNEL);
		if (!p)
			return -ENOMEM;
		register_cpu(p, i, NULL);
		register_cpu(p, i);
	}
	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -808,7 +808,7 @@ static int __init topology_init(void)
	int cpu;

	for_each_possible_cpu(cpu)
		register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu, NULL);
		register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu);

	return 0;
}
+4 −19
Original line number Diff line number Diff line
@@ -32,15 +32,8 @@

static struct i386_cpu cpu_devices[NR_CPUS];

int arch_register_cpu(int num){
	struct node *parent = NULL;

#ifdef CONFIG_NUMA
	int node = cpu_to_node(num);
	if (node_online(node))
		parent = &node_devices[parent_node(node)];
#endif /* CONFIG_NUMA */

int arch_register_cpu(int num)
{
	/*
	 * CPU0 cannot be offlined due to several
	 * restrictions and assumptions in kernel. This basically
@@ -50,21 +43,13 @@ int arch_register_cpu(int num){
	if (!num)
		cpu_devices[num].cpu.no_control = 1;

	return register_cpu(&cpu_devices[num].cpu, num, parent);
	return register_cpu(&cpu_devices[num].cpu, num);
}

#ifdef CONFIG_HOTPLUG_CPU

void arch_unregister_cpu(int num) {
	struct node *parent = NULL;

#ifdef CONFIG_NUMA
	int node = cpu_to_node(num);
	if (node_online(node))
		parent = &node_devices[parent_node(node)];
#endif /* CONFIG_NUMA */

	return unregister_cpu(&cpu_devices[num].cpu, parent);
	return unregister_cpu(&cpu_devices[num].cpu);
}
EXPORT_SYMBOL(arch_register_cpu);
EXPORT_SYMBOL(arch_unregister_cpu);
+2 −15
Original line number Diff line number Diff line
@@ -30,12 +30,6 @@ static struct ia64_cpu *sysfs_cpus;

int arch_register_cpu(int num)
{
	struct node *parent = NULL;
	
#ifdef CONFIG_NUMA
	parent = &node_devices[cpu_to_node(num)];
#endif /* CONFIG_NUMA */

#if defined (CONFIG_ACPI) && defined (CONFIG_HOTPLUG_CPU)
	/*
	 * If CPEI cannot be re-targetted, and this is
@@ -45,21 +39,14 @@ int arch_register_cpu(int num)
		sysfs_cpus[num].cpu.no_control = 1;
#endif

	return register_cpu(&sysfs_cpus[num].cpu, num, parent);
	return register_cpu(&sysfs_cpus[num].cpu, num);
}

#ifdef CONFIG_HOTPLUG_CPU

void arch_unregister_cpu(int num)
{
	struct node *parent = NULL;

#ifdef CONFIG_NUMA
	int node = cpu_to_node(num);
	parent = &node_devices[node];
#endif /* CONFIG_NUMA */

	return unregister_cpu(&sysfs_cpus[num].cpu, parent);
	return unregister_cpu(&sysfs_cpus[num].cpu);
}
EXPORT_SYMBOL(arch_register_cpu);
EXPORT_SYMBOL(arch_unregister_cpu);
+1 −1
Original line number Diff line number Diff line
@@ -275,7 +275,7 @@ static int __init topology_init(void)
	int i;

	for_each_present_cpu(i)
		register_cpu(&cpu_devices[i], i, NULL);
		register_cpu(&cpu_devices[i], i);

	return 0;
}
Loading