Date: Thu, 15 Sep 2011 17:28:13 -0400 From: Arnaud Lacombe <lacombar@gmail.com> To: Robert Watson <rwatson@freebsd.org> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org>, "K. Macy" <kmacy@freebsd.org> Subject: Re: buf_ring(9) API precisions Message-ID: <CACqU3MV_wZN3PQ1%2B-gNHPeEy4MZmp5YGks=HTAbK_7v7vKHyJg@mail.gmail.com> In-Reply-To: <alpine.BSF.2.00.1109152219380.14815@fledge.watson.org> References: <CACqU3MXQ6tD804fKymeFeKDnHndSXVvHJwepYztB4DsnNmtMiw@mail.gmail.com> <CAHM0Q_P7NRQXay-ho1E--P4QnV5kr0eTo48NT21dbJjpbmAF=Q@mail.gmail.com> <alpine.BSF.2.00.1109152219380.14815@fledge.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--bcaec544eb7cdc73ac04ad018df1 Content-Type: text/plain; charset=ISO-8859-1 Hi, On Thu, Sep 15, 2011 at 5:21 PM, Robert Watson <rwatson@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 > --bcaec544eb7cdc73ac04ad018df1 Content-Type: text/x-patch; charset=US-ASCII; name="buf_ring_md_padding.diff" Content-Disposition: attachment; filename="buf_ring_md_padding.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QUNIRV9MSU5FX1NJWkUpOwogCiAvKgog ICogbXVsdGktcHJvZHVjZXIgc2FmZSBsb2NrLWZyZWUgcmluZyBidWZmZXIgZW5xdWV1ZQo= --bcaec544eb7cdc73ac04ad018df1--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACqU3MV_wZN3PQ1%2B-gNHPeEy4MZmp5YGks=HTAbK_7v7vKHyJg>