diff options
author | Tejun Heo <tj@kernel.org> | 2011-07-12 03:58:08 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2011-07-13 19:35:59 -0400 |
commit | 348968eb151e2569ad0ebe19b2f9c3c25b5c816a (patch) | |
tree | b184f5eebca9d40e94dd221d033abc409c600f8c /mm/memblock.c | |
parent | 15fb09722df32b7685be1cbcac198bb556ddaffe (diff) |
memblock: Use round_up/down() instead of memblock_align_up/down()
Signed-off-by: Tejun Heo <tj@kernel.org>
Link: http://lkml.kernel.org/r/1310457490-3356-5-git-send-email-tj@kernel.org
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'mm/memblock.c')
-rw-r--r-- | mm/memblock.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/mm/memblock.c b/mm/memblock.c index 87e512dc8018..9882a88d4a10 100644 --- a/mm/memblock.c +++ b/mm/memblock.c | |||
@@ -41,17 +41,6 @@ static inline const char *memblock_type_name(struct memblock_type *type) | |||
41 | /* | 41 | /* |
42 | * Address comparison utilities | 42 | * Address comparison utilities |
43 | */ | 43 | */ |
44 | |||
45 | static phys_addr_t __init_memblock memblock_align_down(phys_addr_t addr, phys_addr_t size) | ||
46 | { | ||
47 | return addr & ~(size - 1); | ||
48 | } | ||
49 | |||
50 | static phys_addr_t __init_memblock memblock_align_up(phys_addr_t addr, phys_addr_t size) | ||
51 | { | ||
52 | return (addr + (size - 1)) & ~(size - 1); | ||
53 | } | ||
54 | |||
55 | static unsigned long __init_memblock memblock_addrs_overlap(phys_addr_t base1, phys_addr_t size1, | 44 | static unsigned long __init_memblock memblock_addrs_overlap(phys_addr_t base1, phys_addr_t size1, |
56 | phys_addr_t base2, phys_addr_t size2) | 45 | phys_addr_t base2, phys_addr_t size2) |
57 | { | 46 | { |
@@ -87,7 +76,7 @@ static phys_addr_t __init_memblock memblock_find_region(phys_addr_t start, phys_ | |||
87 | if (end < size) | 76 | if (end < size) |
88 | return MEMBLOCK_ERROR; | 77 | return MEMBLOCK_ERROR; |
89 | 78 | ||
90 | base = memblock_align_down((end - size), align); | 79 | base = round_down(end - size, align); |
91 | 80 | ||
92 | /* Prevent allocations returning 0 as it's also used to | 81 | /* Prevent allocations returning 0 as it's also used to |
93 | * indicate an allocation failure | 82 | * indicate an allocation failure |
@@ -102,7 +91,7 @@ static phys_addr_t __init_memblock memblock_find_region(phys_addr_t start, phys_ | |||
102 | res_base = memblock.reserved.regions[j].base; | 91 | res_base = memblock.reserved.regions[j].base; |
103 | if (res_base < size) | 92 | if (res_base < size) |
104 | break; | 93 | break; |
105 | base = memblock_align_down(res_base - size, align); | 94 | base = round_down(res_base - size, align); |
106 | } | 95 | } |
107 | 96 | ||
108 | return MEMBLOCK_ERROR; | 97 | return MEMBLOCK_ERROR; |
@@ -486,7 +475,7 @@ phys_addr_t __init __memblock_alloc_base(phys_addr_t size, phys_addr_t align, ph | |||
486 | /* We align the size to limit fragmentation. Without this, a lot of | 475 | /* We align the size to limit fragmentation. Without this, a lot of |
487 | * small allocs quickly eat up the whole reserve array on sparc | 476 | * small allocs quickly eat up the whole reserve array on sparc |
488 | */ | 477 | */ |
489 | size = memblock_align_up(size, align); | 478 | size = round_up(size, align); |
490 | 479 | ||
491 | found = memblock_find_base(size, align, 0, max_addr); | 480 | found = memblock_find_base(size, align, 0, max_addr); |
492 | if (found != MEMBLOCK_ERROR && | 481 | if (found != MEMBLOCK_ERROR && |
@@ -562,7 +551,7 @@ static phys_addr_t __init memblock_alloc_nid_region(struct memblock_region *mp, | |||
562 | start = mp->base; | 551 | start = mp->base; |
563 | end = start + mp->size; | 552 | end = start + mp->size; |
564 | 553 | ||
565 | start = memblock_align_up(start, align); | 554 | start = round_up(start, align); |
566 | while (start < end) { | 555 | while (start < end) { |
567 | phys_addr_t this_end; | 556 | phys_addr_t this_end; |
568 | int this_nid; | 557 | int this_nid; |
@@ -590,7 +579,7 @@ phys_addr_t __init memblock_alloc_nid(phys_addr_t size, phys_addr_t align, int n | |||
590 | /* We align the size to limit fragmentation. Without this, a lot of | 579 | /* We align the size to limit fragmentation. Without this, a lot of |
591 | * small allocs quickly eat up the whole reserve array on sparc | 580 | * small allocs quickly eat up the whole reserve array on sparc |
592 | */ | 581 | */ |
593 | size = memblock_align_up(size, align); | 582 | size = round_up(size, align); |
594 | 583 | ||
595 | /* We do a bottom-up search for a region with the right | 584 | /* We do a bottom-up search for a region with the right |
596 | * nid since that's easier considering how memblock_nid_range() | 585 | * nid since that's easier considering how memblock_nid_range() |