From: jbarnes@sgi.com (Jesse Barnes)
The patch adds a symlink from /sys/devices/system/node/nodeM/cpuN to the
/sys/devices/cpu/cpuN directory so that a userspace program can determine
which CPUs belong to which nodes easily. Non-NUMA systems can simply pass
NULL in for the root arg and everything will work like it used to.
*/
int __init register_cpu(struct cpu *cpu, int num, struct node *root)
{
+ int error;
+
cpu->node_id = cpu_to_node(num);
cpu->sysdev.id = num;
cpu->sysdev.cls = &cpu_sysdev_class;
- return sys_device_register(&cpu->sysdev);
+
+ error = sys_device_register(&cpu->sysdev);
+ if (!error && root)
+ error = sysfs_create_link(&root->sysdev.kobj,
+ &cpu->sysdev.kobj,
+ kobject_name(&cpu->sysdev.kobj));
+ return error;
}