Commit a36aab89 authored by Mike Rapoport's avatar Mike Rapoport Committed by Linus Torvalds

mm/memblock.c: replace u64 with phys_addr_t where appropriate

Most functions in memblock already use phys_addr_t to represent a
physical address with __memblock_free_late() being an exception.

This patch replaces u64 with phys_addr_t in __memblock_free_late() and
switches several format strings from %llx to %pa to avoid casting from
phys_addr_t to u64.

Link: http://lkml.kernel.org/r/1530637506-1256-1-git-send-email-rppt@linux.vnet.ibm.comSigned-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
Reviewed-by: default avatarPavel Tatashin <pasha.tatashin@oracle.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Cc: Pasha Tatashin <Pavel.Tatashin@microsoft.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4e40987f
...@@ -392,7 +392,7 @@ static int __init_memblock memblock_double_array(struct memblock_type *type, ...@@ -392,7 +392,7 @@ static int __init_memblock memblock_double_array(struct memblock_type *type,
{ {
struct memblock_region *new_array, *old_array; struct memblock_region *new_array, *old_array;
phys_addr_t old_alloc_size, new_alloc_size; phys_addr_t old_alloc_size, new_alloc_size;
phys_addr_t old_size, new_size, addr; phys_addr_t old_size, new_size, addr, new_end;
int use_slab = slab_is_available(); int use_slab = slab_is_available();
int *in_slab; int *in_slab;
...@@ -453,9 +453,9 @@ static int __init_memblock memblock_double_array(struct memblock_type *type, ...@@ -453,9 +453,9 @@ static int __init_memblock memblock_double_array(struct memblock_type *type,
return -1; return -1;
} }
memblock_dbg("memblock: %s is doubled to %ld at [%#010llx-%#010llx]", new_end = addr + new_size - 1;
type->name, type->max * 2, (u64)addr, memblock_dbg("memblock: %s is doubled to %ld at [%pa-%pa]",
(u64)addr + new_size - 1); type->name, type->max * 2, &addr, &new_end);
/* /*
* Found space, we now need to move the array over before we add the * Found space, we now need to move the array over before we add the
...@@ -1438,9 +1438,9 @@ void * __init memblock_virt_alloc_try_nid_raw( ...@@ -1438,9 +1438,9 @@ void * __init memblock_virt_alloc_try_nid_raw(
{ {
void *ptr; void *ptr;
memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=0x%llx max_addr=0x%llx %pF\n", memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=%pa max_addr=%pa %pF\n",
__func__, (u64)size, (u64)align, nid, (u64)min_addr, __func__, (u64)size, (u64)align, nid, &min_addr,
(u64)max_addr, (void *)_RET_IP_); &max_addr, (void *)_RET_IP_);
ptr = memblock_virt_alloc_internal(size, align, ptr = memblock_virt_alloc_internal(size, align,
min_addr, max_addr, nid); min_addr, max_addr, nid);
...@@ -1475,9 +1475,9 @@ void * __init memblock_virt_alloc_try_nid_nopanic( ...@@ -1475,9 +1475,9 @@ void * __init memblock_virt_alloc_try_nid_nopanic(
{ {
void *ptr; void *ptr;
memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=0x%llx max_addr=0x%llx %pF\n", memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=%pa max_addr=%pa %pF\n",
__func__, (u64)size, (u64)align, nid, (u64)min_addr, __func__, (u64)size, (u64)align, nid, &min_addr,
(u64)max_addr, (void *)_RET_IP_); &max_addr, (void *)_RET_IP_);
ptr = memblock_virt_alloc_internal(size, align, ptr = memblock_virt_alloc_internal(size, align,
min_addr, max_addr, nid); min_addr, max_addr, nid);
...@@ -1511,9 +1511,9 @@ void * __init memblock_virt_alloc_try_nid( ...@@ -1511,9 +1511,9 @@ void * __init memblock_virt_alloc_try_nid(
{ {
void *ptr; void *ptr;
memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=0x%llx max_addr=0x%llx %pF\n", memblock_dbg("%s: %llu bytes align=0x%llx nid=%d from=%pa max_addr=%pa %pF\n",
__func__, (u64)size, (u64)align, nid, (u64)min_addr, __func__, (u64)size, (u64)align, nid, &min_addr,
(u64)max_addr, (void *)_RET_IP_); &max_addr, (void *)_RET_IP_);
ptr = memblock_virt_alloc_internal(size, align, ptr = memblock_virt_alloc_internal(size, align,
min_addr, max_addr, nid); min_addr, max_addr, nid);
if (ptr) { if (ptr) {
...@@ -1521,9 +1521,8 @@ void * __init memblock_virt_alloc_try_nid( ...@@ -1521,9 +1521,8 @@ void * __init memblock_virt_alloc_try_nid(
return ptr; return ptr;
} }
panic("%s: Failed to allocate %llu bytes align=0x%llx nid=%d from=0x%llx max_addr=0x%llx\n", panic("%s: Failed to allocate %llu bytes align=0x%llx nid=%d from=%pa max_addr=%pa\n",
__func__, (u64)size, (u64)align, nid, (u64)min_addr, __func__, (u64)size, (u64)align, nid, &min_addr, &max_addr);
(u64)max_addr);
return NULL; return NULL;
} }
#endif #endif
...@@ -1538,9 +1537,10 @@ void * __init memblock_virt_alloc_try_nid( ...@@ -1538,9 +1537,10 @@ void * __init memblock_virt_alloc_try_nid(
*/ */
void __init __memblock_free_early(phys_addr_t base, phys_addr_t size) void __init __memblock_free_early(phys_addr_t base, phys_addr_t size)
{ {
memblock_dbg("%s: [%#016llx-%#016llx] %pF\n", phys_addr_t end = base + size - 1;
__func__, (u64)base, (u64)base + size - 1,
(void *)_RET_IP_); memblock_dbg("%s: [%pa-%pa] %pF\n",
__func__, &base, &end, (void *)_RET_IP_);
kmemleak_free_part_phys(base, size); kmemleak_free_part_phys(base, size);
memblock_remove_range(&memblock.reserved, base, size); memblock_remove_range(&memblock.reserved, base, size);
} }
...@@ -1556,11 +1556,11 @@ void __init __memblock_free_early(phys_addr_t base, phys_addr_t size) ...@@ -1556,11 +1556,11 @@ void __init __memblock_free_early(phys_addr_t base, phys_addr_t size)
*/ */
void __init __memblock_free_late(phys_addr_t base, phys_addr_t size) void __init __memblock_free_late(phys_addr_t base, phys_addr_t size)
{ {
u64 cursor, end; phys_addr_t cursor, end;
memblock_dbg("%s: [%#016llx-%#016llx] %pF\n", end = base + size - 1;
__func__, (u64)base, (u64)base + size - 1, memblock_dbg("%s: [%pa-%pa] %pF\n",
(void *)_RET_IP_); __func__, &base, &end, (void *)_RET_IP_);
kmemleak_free_part_phys(base, size); kmemleak_free_part_phys(base, size);
cursor = PFN_UP(base); cursor = PFN_UP(base);
end = PFN_DOWN(base + size); end = PFN_DOWN(base + 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