linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mel@csn.ul.ie>
To: Mike Kravetz <kravetz@us.ibm.com>
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: Thu, 26 May 2005 13:42:50 +0100 (IST)	[thread overview]
Message-ID: <Pine.LNX.4.58.0505261335500.15422@skynet> (raw)
In-Reply-To: <20050525204056.GA9257@w-mikek2.ibm.com>

On Wed, 25 May 2005, Mike Kravetz wrote:

> 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);
>

You're right. This excessively large calculation is left-over from a Magic
Bug That Wouldn't Go Away at the time. I thought I might be overflowing
the usemap (even though I couldn't be but I was desperate for explanations
at the time). The second calculation does not need "+ sizeof(unsigned
long)"

This wastes a few bytes but should not cause problems. I'll fix it and
release a version against -rc5 on Monday (The delay is because I don't
have access to a test environment right now)

-- 
Mel Gorman
Part-time Phd Student                          Java Applications Developer
University of Limerick                         IBM Dublin Software Lab
--
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>

      reply	other threads:[~2005-05-26 12:42 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
2005-05-26 12:42   ` Mel Gorman [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=Pine.LNX.4.58.0505261335500.15422@skynet \
    --to=mel@csn.ul.ie \
    --cc=akpm@osdl.org \
    --cc=kravetz@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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