[email protected] (YAMAMOTO Takashi) wrote:
> > Yes it does, it switches to cache_line size for alignment for
> > allocations >= cache_line size and to page_size alignment for
> > allocations >= page_size.
>
> kmem_alloc(9F) says:
>
> The allocated memory is at least double-word aligned, so it can
> hold any C data structure. No greater alignment can be
> assumed.
>
> % uname -sr
> SunOS 5.10
>
> so i don't think it's api-wise guaranteed.
> IMO it's better to use a low-level allocator (eg. uvm_km_alloc) for
> alignment-sensitive users.
While for page-size alignment, it makes sense to use uvm_km(9) allocator,
there are quite a few allocations when it is useful to give a separate
cache-line for a structure. I am not sure if it is desirable to sprinkle
pad & align magic each time in the caller's side, instead of adding such
support to kmem(9). Perhaps kmem_cacheline_{alloc,free}?
--
Mindaugas