Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 338734
b: refs/heads/master
c: 8c7b5b4
h: refs/heads/master
v: v3
  • Loading branch information
Yasuaki Ishimatsu authored and Linus Torvalds committed Dec 12, 2012
1 parent cf8d342 commit 1eb143b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8732794b166196cc501c2ddd9e7c97cf45ab64c5
refs/heads/master: 8c7b5b4ed948d1ddf9672ee932a16750b280822a
20 changes: 19 additions & 1 deletion trunk/drivers/base/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,24 @@ static inline void hugetlb_register_node(struct node *node) {}
static inline void hugetlb_unregister_node(struct node *node) {}
#endif

static void node_device_release(struct device *dev)
{
struct node *node = to_node(dev);

#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
/*
* We schedule the work only when a memory section is
* onlined/offlined on this node. When we come here,
* all the memory on this node has been offlined,
* so we won't enqueue new work to this work.
*
* The work is using node->node_work, so we should
* flush work before freeing the memory.
*/
flush_work(&node->node_work);
#endif
kfree(node);
}

/*
* register_node - Setup a sysfs device for a node.
Expand All @@ -265,6 +283,7 @@ int register_node(struct node *node, int num, struct node *parent)

node->dev.id = num;
node->dev.bus = &node_subsys;
node->dev.release = node_device_release;
error = device_register(&node->dev);

if (!error){
Expand Down Expand Up @@ -586,7 +605,6 @@ int register_one_node(int nid)
void unregister_one_node(int nid)
{
unregister_node(node_devices[nid]);
kfree(node_devices[nid]);
node_devices[nid] = NULL;
}

Expand Down

0 comments on commit 1eb143b

Please sign in to comment.