tech-kern archive

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

Re: pserialized queue(9)

Dennis Ferguson <> wrote:
> On 25 Nov, 2014, at 08:29 , Mindaugas Rasiukevicius <>
> wrote:
> > Taylor R Campbell <> wrote:
> >> The attached patch adds _PSZ variants to all the insert, remove, and
> >> foreach operations in <sys/queue.h> to issue the necessary store
> >> barriers, for insert, and data-dependent load barriers, for foreach.
> >> 
> >> <...>
> > 
> > Please do not.  In practice, we only need singly-linked list which is
> > trivial to open-code and apart from data dependency memory barrier for
> > Alpha there is nothing to abstract.  Any other cases of locklist list
> > use generally do not fit into the existing queue(3) macros; this API
> > is quite dated by now and I do not forsee any use of such API around
> > pserialize(9) (it is also poorly named since one may as well use other
> > techniques).
> <...>
> Unfortunately the last two changes to the file changed this, perhaps
> inadvertently, from allowing lookups in the cache from all CPUs in
> parallel with a possible single concurrent writer to having all lookups
> serialized both with the writer and each other.  I suspect the change also
> made it a bit buggy now since cache_reclaim() expects to have blocked
> cache_invalidate() from being run but the latter is now called with no
> lock.

Yes, Joerg broke the name cache concurrency.  This has to be fixed or at
least reverted for netbsd-7.

> In any case, the use in vfs_cache.c required more than a singly-linked
> list (I don't know how you concluded that was all that was necessary), is
> not improved by the open-coding that was done and would be worse still if
> it was all open-coded.  There really needs to be some way to build a
> library of basic data structures which is reusable by some technique
> other than cut-and-paste, and while I don't like the macros I'm not sure
> what they should be replaced with.

No really.. the proposal here is about queue(9) macros and in this respect
it is merely a lockless singly-linked list.  The writer serialisation in
vfs_cache.c (which uses mixed locking strategy, handling additions and the
removals in a different way, so the lookup could be lockless) is way beyond
the queue(9) stuff.

I agree about the need to have a library of data structures.  However,
adding _PSZ macros is a very wrong direction.


Home | Main Index | Thread Index | Old Index