lkml.org 
[lkml]   [2005]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Avoiding external fragmentation with a placement policy Version 11
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 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: 2005-05-25 22:45    [W:0.047 / U:0.792 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site