[PATCH 6/6] mm/bootmem.c: use generic round_up_pow2() macro

From: Nick Wilson
Date: Thu Apr 07 2005 - 20:03:03 EST


From: Nick Wilson <njw@xxxxxxxx>

Use the generic round_up_pow2() instead of a custom rounding method.

Signed-off-by: Nick Wilson <njw@xxxxxxxx>
---


bootmem.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

Index: linux/mm/bootmem.c
===================================================================
--- linux.orig/mm/bootmem.c 2005-04-07 15:13:56.000000000 -0700
+++ linux/mm/bootmem.c 2005-04-07 15:46:41.000000000 -0700
@@ -57,7 +57,7 @@ static unsigned long __init init_bootmem
pgdat->pgdat_next = pgdat_list;
pgdat_list = pgdat;

- mapsize = (mapsize + (sizeof(long) - 1UL)) & ~(sizeof(long) - 1UL);
+ mapsize = round_up_pow2(mapsize, sizeof(long));
bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT);
bdata->node_boot_start = (start << PAGE_SHIFT);
bdata->node_low_pfn = end;
@@ -178,7 +178,7 @@ __alloc_bootmem_core(struct bootmem_data
} else
preferred = 0;

- preferred = ((preferred + align - 1) & ~(align - 1)) >> PAGE_SHIFT;
+ preferred = round_up_pow2(preferred, align) >> PAGE_SHIFT;
preferred += offset;
areasize = (size+PAGE_SIZE-1)/PAGE_SIZE;
incr = align >> PAGE_SHIFT ? : 1;
@@ -219,7 +219,7 @@ found:
*/
if (align < PAGE_SIZE &&
bdata->last_offset && bdata->last_pos+1 == start) {
- offset = (bdata->last_offset+align-1) & ~(align-1);
+ offset = round_up_pow2(bdata->last_offset, align);
BUG_ON(offset > PAGE_SIZE);
remaining_size = PAGE_SIZE-offset;
if (size < remaining_size) {
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/