lkml.org 
[lkml]   [2004]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: slab redzoning
William Lee Irwin III wrote:
>>-if ((size < 4096 || fls(size-1) == fls(size-1+3*BYTES_PER_WORD)))
>>+if (size + 3*BYTES_PER_WORD <= PAGE_SIZE ||

On Sat, May 22, 2004 at 10:02:25AM +0200, Manfred Spraul wrote:
> I understand this change: objects between 4082 and 4095 bytes are
> redzoned and cause order==1 allocations, that's wrong.

William Lee Irwin III wrote:
> >+ ((size & (size - 1)) &&
> >+ (1 << fls(size)) - size > 3*BYTES_PER_WORD))

On Sat, May 22, 2004 at 10:02:25AM +0200, Manfred Spraul wrote:
> Why this change? I've tested my fls(size-1)==fls(size-1-3*4) approach
> and it always returned the right result: No redzoning between 8181 and
> 8192 bytes, between 16373 and 16384, etc.

It returns a false positive when size + 3*BYTES_PER_WORD == 2**n, e.g.
size == 16373. Here, fls(size - 1) == 13, but fls(size - 1 + 12) == 13
while size - 1 + 12 == 16384, where we'd want the check to fail. Or so
my analysis of it goes.

-- wli
-
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-03-22 14:03    [W:0.039 / U:1.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site