On Wed, Apr 02, 2008 at 10:28:07AM +0200, Andi Kleen wrote:
> David Chinner <dgc@xxxxxxx> writes:
> >
> > This just means that the start of the structure is cacheline
> > aligned. I don't think the internal alignment commands force the
> > entire structure to be cacheline aligned, merely pad the struture
> > internally. In that case, even though the specific internal parts of
> > the structure are on separate cache lines, there's no guarantee that
> > all the related members are on the same cacheline. Hence I'm
> > explicitly stating the exact alignment I want for the structure....
>
> Isn't the structure dynamically allocated anyways?
> The full type alignment really only matters for statics/globals
> where the linker can handle it.
Ah, right you are. My bad.
> For the dynamic allocation you would rather need to make sure it
> starts at a cache line boundary explicitely because the allocator doesn't
> know the alignment of the target type, otherwise your careful
> padding might be useless.
Yup. Is there an allocator function gives us cacheline aligned
allocation (apart from a slab initialised with SLAB_HWCACHE_ALIGN)?
There isn't one, right?
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
|