lkml.org 
[lkml]   [2006]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] bitmap: Support for pages > BITS_PER_LONG.
From
Date
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


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-01-20 04:31    [W:0.070 / U:0.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site