Re: [PATCH 09/10] Change table chaining layout

From: Benny Halevy
Date: Mon Oct 22 2007 - 17:17:07 EST


On Oct. 22, 2007, 22:16 +0200, Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> wrote:
> On Mon, 22 Oct 2007 12:49:40 -0700 (PDT)
> Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
>>
>> On Mon, 22 Oct 2007, Geert Uytterhoeven wrote:
>>> Better safe than sorry...
>>>
>>> Is it possible that a chain entry pointer has bit 1 set on architectures
>>> (e.g. m68k) where the natural alignment of 32-bit quantities is _2_ bytes,
>>> not 4?
>> Better make sure that such alignment never happens... But no, I don't
>> think it will, since these things would generally always have to be
>> allocated with an allocator, and the *allocator* won't return 2-byte
>> aligned data structures.
>
> No - but a structure which has other objects in it before the object
> being written out may well be 2 byte aligned on M68K and some of the
> other externally 16bit platforms - ditto local dynamic objects.
>
> Why can't we just make the list one item longer than the entry count and
> stick a NULL on the end of it like normal people ? Then you need one bit
> which ought to be safe for everyone (and if the bit is a macro any CPU
> warped enough to have byte alignment is surely going to have top bits
> spare...)

Alternatively, I proposed to check for end of list in sg_next
by calling it with the next iterator value and number of list elements.
We tried that patch here and it seems like a reasonable alternative.
If folks are interested, I can send the full patch for review.

>
> Alan
> -
> 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/
>

-
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/