Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33248
b: refs/heads/master
c: 6f71271
h: refs/heads/master
v: v3
  • Loading branch information
KAMEZAWA Hiroyuki authored and Linus Torvalds committed Aug 6, 2006
1 parent ab5ba3c commit 2d29780
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 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: 94f563c426a78c97fc2a377315995e6ec8343872
refs/heads/master: 6f712711dbd180aa3777efe5ae3b9b0e915b9471
23 changes: 16 additions & 7 deletions trunk/mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,22 @@ int __add_pages(struct zone *zone, unsigned long phys_start_pfn,
{
unsigned long i;
int err = 0;
int start_sec, end_sec;
/* during initialize mem_map, align hot-added range to section */
start_sec = pfn_to_section_nr(phys_start_pfn);
end_sec = pfn_to_section_nr(phys_start_pfn + nr_pages - 1);

for (i = 0; i < nr_pages; i += PAGES_PER_SECTION) {
err = __add_section(zone, phys_start_pfn + i);
for (i = start_sec; i <= end_sec; i++) {
err = __add_section(zone, i << PFN_SECTION_SHIFT);

/* We want to keep adding the rest of the
* sections if the first ones already exist
/*
* EEXIST is finally dealed with by ioresource collision
* check. see add_memory() => register_memory_resource()
* Warning will be printed if there is collision.
*/
if (err && (err != -EEXIST))
break;
err = 0;
}

return err;
Expand Down Expand Up @@ -213,10 +220,10 @@ static void rollback_node_hotadd(int nid, pg_data_t *pgdat)
}

/* add this memory to iomem resource */
static void register_memory_resource(u64 start, u64 size)
static int register_memory_resource(u64 start, u64 size)
{
struct resource *res;

int ret = 0;
res = kzalloc(sizeof(struct resource), GFP_KERNEL);
BUG_ON(!res);

Expand All @@ -228,7 +235,9 @@ static void register_memory_resource(u64 start, u64 size)
printk("System RAM resource %llx - %llx cannot be added\n",
(unsigned long long)res->start, (unsigned long long)res->end);
kfree(res);
ret = -EEXIST;
}
return ret;
}


Expand Down Expand Up @@ -269,7 +278,7 @@ int add_memory(int nid, u64 start, u64 size)
}

/* register this memory as resource */
register_memory_resource(start, size);
ret = register_memory_resource(start, size);

return ret;
error:
Expand Down

0 comments on commit 2d29780

Please sign in to comment.