Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 30727
b: refs/heads/master
c: 0a54703
h: refs/heads/master
i:
  30725: 9a03cd8
  30723: b3839e4
  30719: 9991833
v: v3
  • Loading branch information
KAMEZAWA Hiroyuki authored and Linus Torvalds committed Jun 28, 2006
1 parent e9134ba commit 04ad84e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9af3c2dea3a3ae4248d81a70b556adfe1dc65d55
refs/heads/master: 0a54703904a4a206686b4e8c3f5a6927b60747aa
25 changes: 25 additions & 0 deletions trunk/mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/memory_hotplug.h>
#include <linux/highmem.h>
#include <linux/vmalloc.h>
#include <linux/ioport.h>

#include <asm/tlbflush.h>

Expand Down Expand Up @@ -192,6 +193,27 @@ static void rollback_node_hotadd(int nid, pg_data_t *pgdat)
return;
}

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

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

res->name = "System RAM";
res->start = start;
res->end = start + size - 1;
res->flags = IORESOURCE_MEM;
if (request_resource(&iomem_resource, res) < 0) {
printk("System RAM resource %llx - %llx cannot be added\n",
(unsigned long long)res->start, (unsigned long long)res->end);
kfree(res);
}
}



int add_memory(int nid, u64 start, u64 size)
{
pg_data_t *pgdat = NULL;
Expand All @@ -217,6 +239,9 @@ int add_memory(int nid, u64 start, u64 size)
/* we online node here. we have no error path from here. */
node_set_online(nid);

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

return ret;
error:
/* rollback pgdat allocation and others */
Expand Down

0 comments on commit 04ad84e

Please sign in to comment.