Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356525
b: refs/heads/master
c: a1e565a
h: refs/heads/master
i:
  356523: 8f220b3
v: v3
  • Loading branch information
Tang Chen authored and Linus Torvalds committed Feb 24, 2013
1 parent 1236165 commit 585d933
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 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: d822b86a99e8d2b7ebbe3aba099288354287a885
refs/heads/master: a1e565aa3cfc7c6252cabc93de8391d12b9216aa
24 changes: 16 additions & 8 deletions trunk/mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,11 +1017,14 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start)
unsigned long zholes_size[MAX_NR_ZONES] = {0};
unsigned long start_pfn = start >> PAGE_SHIFT;

pgdat = arch_alloc_nodedata(nid);
if (!pgdat)
return NULL;
pgdat = NODE_DATA(nid);
if (!pgdat) {
pgdat = arch_alloc_nodedata(nid);
if (!pgdat)
return NULL;

arch_refresh_nodedata(nid, pgdat);
arch_refresh_nodedata(nid, pgdat);
}

/* we can use NODE_DATA(nid) from here */

Expand Down Expand Up @@ -1074,7 +1077,8 @@ int mem_online_node(int nid)
int __ref add_memory(int nid, u64 start, u64 size)
{
pg_data_t *pgdat = NULL;
int new_pgdat = 0;
bool new_pgdat;
bool new_node;
struct resource *res;
int ret;

Expand All @@ -1085,12 +1089,16 @@ int __ref add_memory(int nid, u64 start, u64 size)
if (!res)
goto out;

if (!node_online(nid)) {
{ /* Stupid hack to suppress address-never-null warning */
void *p = NODE_DATA(nid);
new_pgdat = !p;
}
new_node = !node_online(nid);
if (new_node) {
pgdat = hotadd_new_pgdat(nid, start);
ret = -ENOMEM;
if (!pgdat)
goto error;
new_pgdat = 1;
}

/* call arch's memory hotadd */
Expand All @@ -1102,7 +1110,7 @@ int __ref add_memory(int nid, u64 start, u64 size)
/* we online node here. we can't roll back from here. */
node_set_online(nid);

if (new_pgdat) {
if (new_node) {
ret = register_one_node(nid);
/*
* If sysfs file of new node can't create, cpu on the node
Expand Down

0 comments on commit 585d933

Please sign in to comment.