mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Wilson <njw@osdl.org>
To: linux-kernel@vger.kernel.org, akpm@osdl.org, rddunlap@osdl.org
Subject: [PATCH 6/6] mm/bootmem.c: use generic round_up_pow2() macro
Date: Thu, 7 Apr 2005 17:52:25 -0700	[thread overview]
Message-ID: <20050408005225.GG4260@njw.pdx.osdl.net> (raw)
In-Reply-To: <20050408004428.GA4260@njw.pdx.osdl.net>

From: Nick Wilson <njw@osdl.org>

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

Signed-off-by: Nick Wilson <njw@osdl.org>
---


 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) {
_

      parent reply	other threads:[~2005-04-08  0:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-08  0:44 [PATCH 0/6] add " Nick Wilson
2005-04-08  0:48 ` [PATCH 1/6] include/linux/kernel.h: use " Nick Wilson
2005-04-08  0:49 ` [PATCH 2/6] " Nick Wilson
2005-04-08  0:50 ` [PATCH 3/6] include/linux/a.out.h: " Nick Wilson
2005-04-08  0:50 ` [PATCH 0/6] add " Andrew Morton
2005-04-08  9:57   ` P
2005-04-08 10:32     ` P
2005-04-08 18:50   ` [PATCH] Use ALIGN to remove duplicate code Nick Wilson
2005-04-08  0:50 ` [PATCH 4/6] kernel/resource.c: use generic round_up_pow2() macro Nick Wilson
2005-04-08  0:51 ` [PATCH 5/6] lib/bitmap.c: " Nick Wilson
2005-04-08  0:52 ` Nick Wilson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050408005225.GG4260@njw.pdx.osdl.net \
    --to=njw@osdl.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rddunlap@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®