linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <kravetz@us.ibm.com>
To: Mel Gorman <mel@csn.ul.ie>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: Re: Avoiding external fragmentation with a placement policy Version 11
Date: Wed, 25 May 2005 13:40:56 -0700	[thread overview]
Message-ID: <20050525204056.GA9257@w-mikek2.ibm.com> (raw)
In-Reply-To: <20050522200507.6ED7AECFC@skynet.csn.ul.ie>

On Sun, May 22, 2005 at 09:05:07PM +0100, Mel Gorman wrote:
>  /*
> + * Calculate the size of the zone->usemap
> + */
> +static unsigned long __init usemap_size(unsigned long zonesize) {
> +	unsigned long usemapsize;
> +
> +	/* - Number of MAX_ORDER blocks in the zone */
> +	usemapsize = (zonesize + (1 << (MAX_ORDER-1))) >> (MAX_ORDER-1);
> +
> +	/* - BITS_PER_ALLOC_TYPE bits to record what type of block it is */
> +	usemapsize = (usemapsize * BITS_PER_ALLOC_TYPE + (sizeof(unsigned long)*8)) / 8;
> +
> +	return L1_CACHE_ALIGN(usemapsize);
> +}

In the first calculation, I think you are trying to 'round up'.  If this
is the case, then I believe the calculation should be:

usemapsize = (zonesize + ((1 << (MAX_ORDER-1)) - 1) >> (MAX_ORDER-1);

I don't know if there is a similar issue in the second calculation.
Arithmetic is not one of my strengths.

-- 
Mike
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

  parent reply	other threads:[~2005-05-25 20:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-22 20:05 Mel Gorman
2005-05-25 18:04 ` Joel Schopp
2005-05-26 12:35   ` Mel Gorman
2005-05-25 20:40 ` Mike Kravetz [this message]
2005-05-26 12:42   ` Mel Gorman

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=20050525204056.GA9257@w-mikek2.ibm.com \
    --to=kravetz@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    /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