/* * register_node - Setup a sysfs device for a node. * @num - Node number to use when creating the device. * * Initialize and register the node device. */ static int register_node(struct node *node, int num, struct node *parent) { int error; node->dev.id = num; node->dev.bus = &node_subsys; node->dev.release = node_device_release; error = device_register(&node->dev); if (!error){ device_create_file(&node->dev, &dev_attr_cpumap); device_create_file(&node->dev, &dev_attr_cpulist); device_create_file(&node->dev, &dev_attr_meminfo); device_create_file(&node->dev, &dev_attr_numastat); device_create_file(&node->dev, &dev_attr_distance); device_create_file(&node->dev, &dev_attr_vmstat); scan_unevictable_register_node(node); hugetlb_register_node(node); compaction_register_node(node); } return error; }
/* * Handle per node hstate attribute [un]registration on transistions * to/from memoryless state. */ static void node_hugetlb_work(struct work_struct *work) { struct node *node = container_of(work, struct node, node_work); /* * We only get here when a node transitions to/from memoryless state. * We can detect which transition occurred by examining whether the * node has memory now. hugetlb_register_node() already check this * so we try to register the attributes. If that fails, then the * node has transitioned to memoryless, try to unregister the * attributes. */ if (!hugetlb_register_node(node)) hugetlb_unregister_node(node); }
/* * register_node - Setup a sysfs device for a node. * @num - Node number to use when creating the device. * * Initialize and register the node device. */ static int register_node(struct node *node, int num, struct node *parent) { int error; node->dev.id = num; node->dev.bus = &node_subsys; node->dev.release = node_device_release; node->dev.groups = node_dev_groups; error = device_register(&node->dev); if (!error){ hugetlb_register_node(node); compaction_register_node(node); } return error; }
/* * register_node - Setup a sysfs device for a node. * @num - Node number to use when creating the device. * * Initialize and register the node device. */ int register_node(struct node *node, int num, struct node *parent) { int error; node->sysdev.id = num; node->sysdev.cls = &node_class; error = sysdev_register(&node->sysdev); if (!error){ sysdev_create_file(&node->sysdev, &attr_cpumap); sysdev_create_file(&node->sysdev, &attr_cpulist); sysdev_create_file(&node->sysdev, &attr_meminfo); sysdev_create_file(&node->sysdev, &attr_numastat); sysdev_create_file(&node->sysdev, &attr_distance); scan_unevictable_register_node(node); hugetlb_register_node(node); } return error; }