aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memblock.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-12-08 13:22:08 -0500
committerTejun Heo <tj@kernel.org>2011-12-08 13:22:08 -0500
commit7fb0bc3f06fdc3a35e41bcea7a15e53d2515362f (patch)
tree76da7b578a655915276c28047ec11fd678634d99 /mm/memblock.c
parent1aadc0560f46530f8a0f11055285b876a8a31770 (diff)
memblock: Implement memblock_add_node()
Implement memblock_add_node() which can add a new memblock memory region with specific node ID. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Yinghai Lu <yinghai@kernel.org>
Diffstat (limited to 'mm/memblock.c')
-rw-r--r--mm/memblock.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index a3ca95f35e03..ef4987b03afd 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -324,6 +324,7 @@ static void __init_memblock memblock_insert_region(struct memblock_type *type,
324 * @type: memblock type to add new region into 324 * @type: memblock type to add new region into
325 * @base: base address of the new region 325 * @base: base address of the new region
326 * @size: size of the new region 326 * @size: size of the new region
327 * @nid: nid of the new region
327 * 328 *
328 * Add new memblock region [@base,@base+@size) into @type. The new region 329 * Add new memblock region [@base,@base+@size) into @type. The new region
329 * is allowed to overlap with existing ones - overlaps don't affect already 330 * is allowed to overlap with existing ones - overlaps don't affect already
@@ -334,7 +335,7 @@ static void __init_memblock memblock_insert_region(struct memblock_type *type,
334 * 0 on success, -errno on failure. 335 * 0 on success, -errno on failure.
335 */ 336 */
336static int __init_memblock memblock_add_region(struct memblock_type *type, 337static int __init_memblock memblock_add_region(struct memblock_type *type,
337 phys_addr_t base, phys_addr_t size) 338 phys_addr_t base, phys_addr_t size, int nid)
338{ 339{
339 bool insert = false; 340 bool insert = false;
340 phys_addr_t obase = base; 341 phys_addr_t obase = base;
@@ -346,7 +347,7 @@ static int __init_memblock memblock_add_region(struct memblock_type *type,
346 WARN_ON(type->cnt != 1 || type->total_size); 347 WARN_ON(type->cnt != 1 || type->total_size);
347 type->regions[0].base = base; 348 type->regions[0].base = base;
348 type->regions[0].size = size; 349 type->regions[0].size = size;
349 memblock_set_region_node(&type->regions[0], MAX_NUMNODES); 350 memblock_set_region_node(&type->regions[0], nid);
350 type->total_size = size; 351 type->total_size = size;
351 return 0; 352 return 0;
352 } 353 }
@@ -376,7 +377,7 @@ repeat:
376 nr_new++; 377 nr_new++;
377 if (insert) 378 if (insert)
378 memblock_insert_region(type, i++, base, 379 memblock_insert_region(type, i++, base,
379 rbase - base, MAX_NUMNODES); 380 rbase - base, nid);
380 } 381 }
381 /* area below @rend is dealt with, forget about it */ 382 /* area below @rend is dealt with, forget about it */
382 base = min(rend, end); 383 base = min(rend, end);
@@ -386,8 +387,7 @@ repeat:
386 if (base < end) { 387 if (base < end) {
387 nr_new++; 388 nr_new++;
388 if (insert) 389 if (insert)
389 memblock_insert_region(type, i, base, end - base, 390 memblock_insert_region(type, i, base, end - base, nid);
390 MAX_NUMNODES);
391 } 391 }
392 392
393 /* 393 /*
@@ -406,9 +406,15 @@ repeat:
406 } 406 }
407} 407}
408 408
409int __init_memblock memblock_add_node(phys_addr_t base, phys_addr_t size,
410 int nid)
411{
412 return memblock_add_region(&memblock.memory, base, size, nid);
413}
414
409int __init_memblock memblock_add(phys_addr_t base, phys_addr_t size) 415int __init_memblock memblock_add(phys_addr_t base, phys_addr_t size)
410{ 416{
411 return memblock_add_region(&memblock.memory, base, size); 417 return memblock_add_region(&memblock.memory, base, size, MAX_NUMNODES);
412} 418}
413 419
414/** 420/**
@@ -522,7 +528,7 @@ int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
522 (void *)_RET_IP_); 528 (void *)_RET_IP_);
523 BUG_ON(0 == size); 529 BUG_ON(0 == size);
524 530
525 return memblock_add_region(_rgn, base, size); 531 return memblock_add_region(_rgn, base, size, MAX_NUMNODES);
526} 532}
527 533
528/** 534/**