buf_ring(9) API precisions

Arnaud Lacombe lacombar at gmail.com
Thu Sep 15 21:28:15 UTC 2011


Hi,

On Thu, Sep 15, 2011 at 5:21 PM, Robert Watson <rwatson at freebsd.org> wrote:
> On Thu, 15 Sep 2011, K. Macy wrote:
>
>>> Why are you making an MD guess, the amount of padding to fit the size of
>>> a cache line, in MI API ? Strangely enough, you did not make this assumption
>>> in, say r205488 (picked randomly).
>>
>> It has been several years, and I haven't done any work in svn in over a
>> year, I don't remember. I probably meant to refine it in a later iteration.
>>
>> If you would like to send me a patch addressing this I'd be more than
>> happy to apply it if appropriate. Otherwise, I will deal with it some time
>> after 9 settles.
>>
>> Thanks for pointing this out.
>
> I'm not sure if gcc (and friends) allow __aligned(CACHE_LINE_SIZE) to be
> used on individual elements of a struct (causing appropriate padding to be
> added), but that may be one option here.
>
It definitively does, it is used in several structure in the tree.

Attached a patch to convert buf_ring(9), however, I'm not a huge fan
of dedicating a full cache line to the lock pointer.

 - Arnaud

> Of course, that introduces a
> further alignment requirement on the struct itself, so a moderate amount of
> care would need to be used.
>
> Robert
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: buf_ring_md_padding.diff
Type: text/x-patch
Size: 850 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20110915/390d2827/buf_ring_md_padding.bin


More information about the freebsd-hackers mailing list