tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pserialize(9) vs. TAILQ



On Wed, Nov 19, 2014 at 10:15 AM, Masao Uebayashi <uebayasi%gmail.com@localhost> wrote:
> On Wed, Nov 19, 2014 at 2:53 AM, Taylor R Campbell
> <campbell+netbsd-tech-kern%mumble.net@localhost> wrote:
>> The one tricky detail is that after a reader has fetched the tqe_next
>> pointer, it must issue a membar_consumer before dereferencing the
>> pointer: otherwise there is no guarantee about the order in which the
>> CPU will fetch the tqe_next pointer and its contents (which it may
>> have cached).  Whoever inserts entries must also issue a
>> membar_producer after initializing the entry and before inserting it,
>> to match the reader's membar_consumer.
>
> Good point.
>
>> Someone^TM should invent names for queue operations that are
>> pserialize-safe by virtue of automatically issuing these memory
>> barriers: TAILQ_FOREACH_PSZ, TAILQ_INSERT_HEAD_PSZ, &c., or something,
>> so that it is easier to use them correctly and spot incorrect use.
>
> I think providing only TAILQ-for-pserialize(9) is enough.  Maybe
> PSZQ()?  I don't really mind the name.

Well, struct doesn't need to change, only memory barriers need to be
placed in read/write paths.  TAILQ_*_PSZ is better.


Home | Main Index | Thread Index | Old Index