diff options
Diffstat (limited to 'mm/memory_hotplug.c')
-rw-r--r-- | mm/memory_hotplug.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 7666dbd328df..fd678a662eae 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -26,6 +26,36 @@ | |||
26 | 26 | ||
27 | #include <asm/tlbflush.h> | 27 | #include <asm/tlbflush.h> |
28 | 28 | ||
29 | /* add this memory to iomem resource */ | ||
30 | static struct resource *register_memory_resource(u64 start, u64 size) | ||
31 | { | ||
32 | struct resource *res; | ||
33 | res = kzalloc(sizeof(struct resource), GFP_KERNEL); | ||
34 | BUG_ON(!res); | ||
35 | |||
36 | res->name = "System RAM"; | ||
37 | res->start = start; | ||
38 | res->end = start + size - 1; | ||
39 | res->flags = IORESOURCE_MEM; | ||
40 | if (request_resource(&iomem_resource, res) < 0) { | ||
41 | printk("System RAM resource %llx - %llx cannot be added\n", | ||
42 | (unsigned long long)res->start, (unsigned long long)res->end); | ||
43 | kfree(res); | ||
44 | res = NULL; | ||
45 | } | ||
46 | return res; | ||
47 | } | ||
48 | |||
49 | static void release_memory_resource(struct resource *res) | ||
50 | { | ||
51 | if (!res) | ||
52 | return; | ||
53 | release_resource(res); | ||
54 | kfree(res); | ||
55 | return; | ||
56 | } | ||
57 | |||
58 | |||
29 | #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE | 59 | #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE |
30 | static int __add_zone(struct zone *zone, unsigned long phys_start_pfn) | 60 | static int __add_zone(struct zone *zone, unsigned long phys_start_pfn) |
31 | { | 61 | { |
@@ -223,36 +253,6 @@ static void rollback_node_hotadd(int nid, pg_data_t *pgdat) | |||
223 | return; | 253 | return; |
224 | } | 254 | } |
225 | 255 | ||
226 | /* add this memory to iomem resource */ | ||
227 | static struct resource *register_memory_resource(u64 start, u64 size) | ||
228 | { | ||
229 | struct resource *res; | ||
230 | res = kzalloc(sizeof(struct resource), GFP_KERNEL); | ||
231 | BUG_ON(!res); | ||
232 | |||
233 | res->name = "System RAM"; | ||
234 | res->start = start; | ||
235 | res->end = start + size - 1; | ||
236 | res->flags = IORESOURCE_MEM; | ||
237 | if (request_resource(&iomem_resource, res) < 0) { | ||
238 | printk("System RAM resource %llx - %llx cannot be added\n", | ||
239 | (unsigned long long)res->start, (unsigned long long)res->end); | ||
240 | kfree(res); | ||
241 | res = NULL; | ||
242 | } | ||
243 | return res; | ||
244 | } | ||
245 | |||
246 | static void release_memory_resource(struct resource *res) | ||
247 | { | ||
248 | if (!res) | ||
249 | return; | ||
250 | release_resource(res); | ||
251 | kfree(res); | ||
252 | return; | ||
253 | } | ||
254 | |||
255 | |||
256 | 256 | ||
257 | int add_memory(int nid, u64 start, u64 size) | 257 | int add_memory(int nid, u64 start, u64 size) |
258 | { | 258 | { |