aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorGavin Shan <shangw@linux.vnet.ibm.com>2012-05-29 18:06:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-29 19:22:24 -0400
commit4e2f07750d9a94e8f23e86408df5ab95be88bf11 (patch)
tree8d2d1b24619817b9a553361a9dc967b3c39a2585 /mm
parent5bf5f03c271907978489868a4c72aeb42b5127d2 (diff)
mm/memblock: cleanup on duplicate VA/PA conversion
The overall memblock has been organized into the memory regions and reserved regions. Initially, the memory regions and reserved regions are stored in the predetermined arrays of "struct memblock _region". It's possible for the arrays to be enlarged when we have newly added regions for them, but no enough space there. Under the situation, We will created double-sized array to meet the requirement. However, the original implementation converted the VA (Virtual Address) of the newly allocated array of regions to PA (Physical Address), then translate back when we allocates the new array from slab. That's actually unnecessary. The patch removes the duplicate VA/PA conversion. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memblock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index a44eab3157f8..eae06ea3aa50 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -212,14 +212,15 @@ static int __init_memblock memblock_double_array(struct memblock_type *type)
212 if (use_slab) { 212 if (use_slab) {
213 new_array = kmalloc(new_size, GFP_KERNEL); 213 new_array = kmalloc(new_size, GFP_KERNEL);
214 addr = new_array ? __pa(new_array) : 0; 214 addr = new_array ? __pa(new_array) : 0;
215 } else 215 } else {
216 addr = memblock_find_in_range(0, MEMBLOCK_ALLOC_ACCESSIBLE, new_size, sizeof(phys_addr_t)); 216 addr = memblock_find_in_range(0, MEMBLOCK_ALLOC_ACCESSIBLE, new_size, sizeof(phys_addr_t));
217 new_array = addr ? __va(addr) : 0;
218 }
217 if (!addr) { 219 if (!addr) {
218 pr_err("memblock: Failed to double %s array from %ld to %ld entries !\n", 220 pr_err("memblock: Failed to double %s array from %ld to %ld entries !\n",
219 memblock_type_name(type), type->max, type->max * 2); 221 memblock_type_name(type), type->max, type->max * 2);
220 return -1; 222 return -1;
221 } 223 }
222 new_array = __va(addr);
223 224
224 memblock_dbg("memblock: %s array is doubled to %ld at [%#010llx-%#010llx]", 225 memblock_dbg("memblock: %s array is doubled to %ld at [%#010llx-%#010llx]",
225 memblock_type_name(type), type->max * 2, (u64)addr, (u64)addr + new_size - 1); 226 memblock_type_name(type), type->max * 2, (u64)addr, (u64)addr + new_size - 1);