CVSROOT:        /cvs
Module name:    src
Changes by:     d...@cvs.openbsd.org    2020/06/07 17:23:30

Modified files:
        sys/kern       : kern_task.c 

Log message:
add support for running taskq_barrier from a task inside the taskq.

this is required for an upcoming drm update, where the linux workqueue
api that supports this is mapped to our taskq api.

this main way taskqs support that is to have the taskq worker threads
record thir curproc on the taskq, so taskq_barrier calls can iterate
over that list looking for their own curproc. if a barriers curproc
is in the list, it must be running inside the taskq, and should
pretend that it's a barrier task.

this also supports concurrent barrier calls by having the taskq
recognise the situation and have the barriers work together rather
than deadlocking. they end up trying to share the work of getting
the barrier tasks onto the workers. once all the workers (or in tq
barriers) have rendezvoused the barrier calls unwind, and the last
one out lets the other barriers and barrier tasks return.

all this barrier logic is implemented in the barrier code, it takes
the existing multiworker handling out of the actual taskq loop.

thanks to jsg@ for testing this and previous versions of the diff.
ok visa@ kettenis@

Reply via email to