Home | History | Annotate | Download | only in man9
History log of /src/share/man/man9/pcq.9
RevisionDateAuthorComments
 1.9  23-Feb-2023  riastradh pcq(9): Document memory ordering guarantees.
 1.8  08-Feb-2018  dholland branches: 1.8.14;
Typo fixes from Eitan Adler.
 1.7  18-Apr-2015  mlelstv fix reference to queue(3)
 1.6  22-Jan-2012  rmind Replace pcq(9) with the implementation from ad@ and minor changes by me.

PR/40516, PR/45631.
 1.5  02-Dec-2010  wiz branches: 1.5.6;
Remove boilerplate in CODE REFERENCES on file paths.
Describe in intro(9) how to read paths in the CODE REFERENCES section.
 1.4  08-Jan-2010  wiz Remove empty line. Bump date for previous.
 1.3  08-Jan-2010  rmind pcq(9): use more accurate wording, do not expose implementation details.
 1.2  04-Jan-2010  wiz Sort NAME section and removing trailing dot; remove duplicate RCS Id.
 1.1  04-Jan-2010  dyoung Add a manual page for producer/consumer queues, pcq(9), that I derived
from some documentation written by Matt Thomas.
 1.5.6.1  17-Apr-2012  yamt sync with head
 1.8.14.1  30-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #263):

share/man/man9/pcq.9: revision 1.9
sys/kern/subr_pcq.c: revision 1.14
sys/kern/subr_pcq.c: revision 1.15
sys/kern/subr_pcq.c: revision 1.16
sys/kern/subr_pcq.c: revision 1.17
sys/kern/subr_pcq.c: revision 1.18
sys/kern/subr_pcq.c: revision 1.19

pcq(9): Make pcq_put a release operation, in memory ordering.

Otherwise, for example, the following assertion could fail:
/* publisher */
nusers = foo->nusers;
pcq_put(pcq, foo);
KASSERT(nusers == 0);
/* user */
foo = pcq_get(pcq);
if (foo != NULL)
atomic_inc_uint(&foo->nusers);


pcq(9): Fix consume operation in pcq_peek/get.

These use atomic_load_consume to match the atomic_store_release in
pcq_put for pcq->pcq_items[c].

Reading the snapshot of pcq->pcq_pc need not be ordered:
- The consumer side (pcq_peek/get) is serialized by the API contract
(single-consumer, multi-producer), so no ordering is necessary.
- The producer side updates pcq->pcq_pc first; if the consumer side
sees that before the producer side has stored pcq->pcq_items[c],
there's no problem -- it's as if the consumer had happened just a
moment earlier and the producer hadn't entered pcq_put yet.

However, it should be an atomic load, not a plain load. So use
atomic_load_relaxed, if for no other reason than to pacify thread
sanitizers.


pcq(9): Explain why store need not be atomic in pcq_get.
No functional change intended.

pcq(9): Explain why membar_release isn't needed in pcq_get.
No functional change intended.

pcq(9): Document memory ordering guarantees.

pcq(9): Sketch correctness proof for some critical properties.
No functional change intended.

pcq(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B)

RSS XML Feed