Skip to contentSkip to conversation

Memory hotplug for new nodes v.4.(arch_register_node() for ia64)

PATCH In review Yasunori Goto 2 participants 5 messages Mar 17, 2006 – Mar 21, 2006 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 17/17 Memory hotplug for new nodes v.4.(arch_register_node() for ia64)

This is to create sysfs file for new node.
It adds arch specific functions 'arch_register_node()' and 'arch_unregister_node()' to IA64 to call the generic function 'register_node()' and 'unregister_node()' respectively.

 arch/ia64/kernel/topology.c |   15 +++++++++++++++
 include/linux/node.h        |    2 ++
 2 files changed, 17 insertions(+)

Index: pgdat8/arch/ia64/kernel/topology.c
=================================--- pgdat8.orig/arch/ia64/kernel/topology.c 2006-03-16 16:04:54.000000000 +0900
+++ pgdat8/arch/ia64/kernel/topology.c 2006-03-16 16:06:27.000000000 +0900
@@ -65,6 +65,21 @@ EXPORT_SYMBOL(arch_register_cpu);
EXPORT_SYMBOL(arch_unregister_cpu);
#endif /*CONFIG_HOTPLUG_CPU*/

+#ifdef CONFIG_NUMA
+int arch_register_node(int num)
+{
+ if (sysfs_nodes[num].sysdev.id = num)
+ return 0;
+
+ return register_node(&sysfs_nodes[num], num, 0);
+}
+
+void arch_unregister_node(int num)
+{
+ unregister_node(&sysfs_nodes[num]);
+ sysfs_nodes[num].sysdev.id = -1;
+}
+#endif

static int __init topology_init(void)
{
Index: pgdat8/include/linux/node.h
=================================--- pgdat8.orig/include/linux/node.h 2006-03-16 16:04:54.000000000 +0900
+++ pgdat8/include/linux/node.h 2006-03-16 16:06:27.000000000 +0900
@@ -28,6 +28,8 @@ struct node {

extern int register_node(struct node *, int, struct node *); extern void unregister_node(struct node *node);
+extern int arch_register_node(int num);
+extern void arch_unregister_node(int num);

#define to_node(sys_device) container_of(sys_device, struct node, sysdev)

Signature · 1 line
Yasunori Goto 
#1 lore raw
Quoted 10 lines · Yasunori Goto

+++ pgdat8/arch/ia64/kernel/topology.c 2006-03-16 16:06:27.000000000 +0900

(quoted diff) +5 -0
@@ -65,6 +65,21 @@ EXPORT_SYMBOL(arch_register_cpu);
 EXPORT_SYMBOL(arch_unregister_cpu);
 #endif /*CONFIG_HOTPLUG_CPU*/
 
+#ifdef CONFIG_NUMA
+int arch_register_node(int num)
+{
+	if (sysfs_nodes[num].sysdev.id = num)
+		return 0;

Review EXPORT_SYMBOL(arch_register_cpu); · line 82

Quoted 10 lines
(quoted diff) +10 -0
+
+	return register_node(&sysfs_nodes[num], num, 0);
+}
+
+void arch_unregister_node(int num)
+{
+	unregister_node(&sysfs_nodes[num]);
+	sysfs_nodes[num].sysdev.id = -1;
+}
+#endif

I don't have a real problem with you cluttering up ia64 code, but if these are useful, why don't we put them in generic code? They seem quite arch-independent to me.

-- Dave

#2 lore raw
Quoted 17 lines · Yasunori Goto
Quoted 16 lines

+++ pgdat8/arch/ia64/kernel/topology.c 2006-03-16 16:06:27.000000000 +0900

(quoted diff) +11 -0
@@ -65,6 +65,21 @@ EXPORT_SYMBOL(arch_register_cpu);
 EXPORT_SYMBOL(arch_unregister_cpu);
 #endif /*CONFIG_HOTPLUG_CPU*/
 
+#ifdef CONFIG_NUMA
+int arch_register_node(int num)
+{
+	if (sysfs_nodes[num].sysdev.id = num)
+		return 0;
+
+	return register_node(&sysfs_nodes[num], num, 0);
+}
+
+void arch_unregister_node(int num)
+{
Quoted 8 lines

Review EXPORT_SYMBOL(arch_register_cpu); · line 82

Quoted 4 lines
(quoted diff) +4 -0
+	unregister_node(&sysfs_nodes[num]);
+	sysfs_nodes[num].sysdev.id = -1;
+}
+#endif

I don't have a real problem with you cluttering up ia64 code, but if these are useful, why don't we put them in generic code? They seem quite arch-independent to me.

I'm not sure they can be common code.

Current i386's code treats "parent node" in arch_register_node(). But, IA64 doesn't need it.

Bye.

Signature · 1 line
Yasunori Goto 
#3 lore raw
Quoted 2 lines · Yasunori Goto

Current i386's code treats "parent node" in arch_register_node(). But, IA64 doesn't need it.

I'm not sure I understand. What do you mean by "treats"?

-- Dave

#4 lore raw
Quoted 5 lines · Yasunori Goto
Quoted 2 lines

Current i386's code treats "parent node" in arch_register_node(). But, IA64 doesn't need it.

I'm not sure I understand. What do you mean by "treats"?

Oops. My English may be wrong. :-(
I mean that i386 seems trying to make relationship of parent and child among each node.

Signature · 1 line
Yasunori Goto