All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Paul Jackson <pj@sgi.com>
Cc: Paul Mundt <lethal@linux-sh.org>,
	linux-kernel@vger.kernel.org, akpm@osdl.org,
	an Molton <spyro@f2s.com>,
	tony@atomide.com, jamey.hicks@hp.com, joshua@joshuawise.com,
	david-b@pacbell.net, Russell King <rmk@arm.linux.org.uk>
Subject: Re: [PATCH] bitmap: Support for pages > BITS_PER_LONG.
Date: Thu, 19 Jan 2006 21:28:30 -0600	[thread overview]
Message-ID: <1137727710.3571.51.camel@mulgrave> (raw)
In-Reply-To: <20060118191157.f653b09d.pj@sgi.com>

On Wed, 2006-01-18 at 19:11 -0800, Paul Jackson wrote:
> Could you look Mundt's patch, and see if it looks ok?

Not being on lkml, this was harder than it sounds, but I eventually
found the actual patch on marc.  However, no, it doesn't look right.

This:

> +		/* find space in the bitmap */
> +		for (j = 0; j < span; j++)
> +			if ((bitmap[index + j] & (mask << offset))) {


Is wrong.  You're looking for an unset span of order bits at a given
offset.  So you get the byte offset for the first, then all the
following bitmap[n] need to be zero until you need to do an offset in
reverse for the last bit.  i.e. (assuming BITS_PER_LONG=32) for a span
of 126 at offset 1, you check

bitmap[0] & 0xfffffffe == 0
bitmap[1] & 0xffffffff == 0
bitmap[2] & 0xffffffff == 0
bitmap[3] & 0x7fffffff == 0

and so on.

> +				space = 0;
> +				break;
> +			}
> +
> +		/* keep looking */
> +		if (unlikely(!space))
> +			continue;
> +
> +		for (j = 0; j < span; j++)
> +			/* set region in bitmap */
> +			bitmap[index + j] |= (mask << offset);

Likewise, you'd have to or in what you checked above.

James



  reply	other threads:[~2006-01-20  3:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-19  1:48 [PATCH] bitmap: Support for pages > BITS_PER_LONG Paul Mundt
2006-01-19  3:11 ` Paul Jackson
2006-01-20  3:28   ` James Bottomley [this message]
2006-01-20  7:28     ` Paul Mundt
2006-01-20  9:10     ` Paul Jackson
2006-01-19  6:07 ` Paul Jackson
2006-01-19  6:40   ` Paul Jackson

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=1137727710.3571.51.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --cc=akpm@osdl.org \
    --cc=david-b@pacbell.net \
    --cc=jamey.hicks@hp.com \
    --cc=joshua@joshuawise.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pj@sgi.com \
    --cc=rmk@arm.linux.org.uk \
    --cc=spyro@f2s.com \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.