Re: [PATCH] slub: fix check_bytes() for slub debugging

From: Marcin Slusarz
Date: Mon Aug 08 2011 - 17:24:27 EST


On Sun, Aug 07, 2011 at 06:30:38PM +0900, Akinobu Mita wrote:
> The check_bytes() function is used by slub debugging. It returns a pointer
> to the first unmatching byte for a character in the given memory area.
>
> If the character for matching byte is greater than 0x80, check_bytes()
> doesn't work. Becuase 64-bit pattern is generated as below.
>
> value64 = value | value << 8 | value << 16 | value << 24;
> value64 = value64 | value64 << 32;
>
> The integer promotions are performed and sign-extended as the type of value
> is u8. The upper 32 bits of value64 is 0xffffffff in the first line, and
> the second line has no effect.
>
> This fixes the 64-bit pattern generation.

Thank you. I'm a bit ashamed about this bug... I introduced this bug, so:
Reviewed-by: Marcin Slusarz <marcin.slusarz@xxxxxxxxx>

I tested your patch to check if performance improvements of commit
c4089f98e943ff445665dea49c190657b34ccffe come from this bug or not.
And forunately they aren't - performance is exactly the same.

How did you find it?

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