Commit fd07383b authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

mm/memblock.c:memblock_double_array(): cosmetic cleanups

This function is an 80-column eyesore, quite unnecessarily.  Clean that
up, and use standard comment layout style.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Greg Pearson <greg.pearson@hp.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4f774b91
...@@ -222,13 +222,13 @@ static int __init_memblock memblock_double_array(struct memblock_type *type, ...@@ -222,13 +222,13 @@ static int __init_memblock memblock_double_array(struct memblock_type *type,
/* Try to find some space for it. /* Try to find some space for it.
* *
* WARNING: We assume that either slab_is_available() and we use it or * WARNING: We assume that either slab_is_available() and we use it or
* we use MEMBLOCK for allocations. That means that this is unsafe to use * we use MEMBLOCK for allocations. That means that this is unsafe to
* when bootmem is currently active (unless bootmem itself is implemented * use when bootmem is currently active (unless bootmem itself is
* on top of MEMBLOCK which isn't the case yet) * implemented on top of MEMBLOCK which isn't the case yet)
* *
* This should however not be an issue for now, as we currently only * This should however not be an issue for now, as we currently only
* call into MEMBLOCK while it's still active, or much later when slab is * call into MEMBLOCK while it's still active, or much later when slab
* active for memory hotplug operations * is active for memory hotplug operations
*/ */
if (use_slab) { if (use_slab) {
new_array = kmalloc(new_size, GFP_KERNEL); new_array = kmalloc(new_size, GFP_KERNEL);
...@@ -243,8 +243,8 @@ static int __init_memblock memblock_double_array(struct memblock_type *type, ...@@ -243,8 +243,8 @@ static int __init_memblock memblock_double_array(struct memblock_type *type,
new_alloc_size, PAGE_SIZE); new_alloc_size, PAGE_SIZE);
if (!addr && new_area_size) if (!addr && new_area_size)
addr = memblock_find_in_range(0, addr = memblock_find_in_range(0,
min(new_area_start, memblock.current_limit), min(new_area_start, memblock.current_limit),
new_alloc_size, PAGE_SIZE); new_alloc_size, PAGE_SIZE);
new_array = addr ? __va(addr) : 0; new_array = addr ? __va(addr) : 0;
} }
...@@ -254,12 +254,14 @@ static int __init_memblock memblock_double_array(struct memblock_type *type, ...@@ -254,12 +254,14 @@ static int __init_memblock memblock_double_array(struct memblock_type *type,
return -1; return -1;
} }
memblock_dbg("memblock: %s array is doubled to %ld at [%#010llx-%#010llx]", memblock_dbg("memblock: %s is doubled to %ld at [%#010llx-%#010llx]",
memblock_type_name(type), type->max * 2, (u64)addr, (u64)addr + new_size - 1); memblock_type_name(type), type->max * 2, (u64)addr,
(u64)addr + new_size - 1);
/* Found space, we now need to move the array over before /*
* we add the reserved region since it may be our reserved * Found space, we now need to move the array over before we add the
* array itself that is full. * reserved region since it may be our reserved array itself that is
* full.
*/ */
memcpy(new_array, type->regions, old_size); memcpy(new_array, type->regions, old_size);
memset(new_array + type->max, 0, old_size); memset(new_array + type->max, 0, old_size);
...@@ -267,17 +269,16 @@ static int __init_memblock memblock_double_array(struct memblock_type *type, ...@@ -267,17 +269,16 @@ static int __init_memblock memblock_double_array(struct memblock_type *type,
type->regions = new_array; type->regions = new_array;
type->max <<= 1; type->max <<= 1;
/* Free old array. We needn't free it if the array is the /* Free old array. We needn't free it if the array is the static one */
* static one
*/
if (*in_slab) if (*in_slab)
kfree(old_array); kfree(old_array);
else if (old_array != memblock_memory_init_regions && else if (old_array != memblock_memory_init_regions &&
old_array != memblock_reserved_init_regions) old_array != memblock_reserved_init_regions)
memblock_free(__pa(old_array), old_alloc_size); memblock_free(__pa(old_array), old_alloc_size);
/* Reserve the new array if that comes from the memblock. /*
* Otherwise, we needn't do it * Reserve the new array if that comes from the memblock. Otherwise, we
* needn't do it
*/ */
if (!use_slab) if (!use_slab)
BUG_ON(memblock_reserve(addr, new_alloc_size)); BUG_ON(memblock_reserve(addr, new_alloc_size));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment