lkml.org 
[lkml]   [2007]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [rfc][patch] slob: improvements
On Tue, May 15, 2007 at 10:43:05AM +0200, Nick Piggin wrote:
> This patch goes on top of my previous RCU patch, and has various
> improvements for slob I noticed while implementing said patch ;)
>
> Comments?

I'm warming to this. Please check that the comment block at the top is
still accurate.

> +/*
> + * slob_block has a field 'units', which indicates size of block if +ve,
> + * or offset of next block if -ve (in SLOB_UNITs).
> + *
> + * Free blocks of size 1 unit simply contain the offset of the next block.
> + * Those with larger size contain their size in the first SLOB_UNIT of
> + * memory, and the offset of the next free block in the second SLOB_UNIT.
> + */
> +#if PAGE_SIZE <= (32*1024)
> +typedef s16 slobidx_t;
> +#else
> +typedef s32 slobidx_t;
> +#endif

This math is wrong because you're doing pointer math on slobidx_ts:

> +static slob_t *slob_next(slob_t *s)
> +{
> + slob_t *base = (slob_t *)((unsigned long)s & PAGE_MASK);
> + slobidx_t next;
> +
> + if (s[0].units < 0)
> + next = -s[0].units;
> + else
> + next = s[1].units;
> + return base+next;
> +}

The max is 64K.

--
Mathematics is the supreme nostalgia of our time.
-
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: 2007-05-15 17:21    [W:0.042 / U:0.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site