tech-kern archive

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

Re: workqueue_drain



On Wed, 20 Dec 2017, Michael van Elst wrote:

ozaki-r%netbsd.org@localhost (Ryota Ozaki) writes:

On Wed, Dec 20, 2017 at 8:06 PM, Michael van Elst <mlelstv%serpens.de@localhost>
 wrote:
What about a method that waits for a specific work to complete?

It might be useful but how it works in this case?

You could remember the last work enqueued and wait for it to finish
before destroying the queue. For this the wait function must handle
the case where the work already has finished.

In the case of a WQ_PERCPU workqueue, this could be tricky.  The last
wor enqueued might be for an otherwise-idle CPU and could be finished
while somee other CPU(s) still have entries queued...

I would consider such a function more versatile than just a drain
function.

I'm not totally convinced here.  It might be useful to wait for a
particular work to be finished in order to allow it to be enqueued
again (no work can be enqueued if already in the queue).  But I don't
see how "remember the last work enqueued and wait for it to be done
before destroying" is more versatile than "waiting for all to be done
before destroying".  It certainly seems that the latter is a simpler
approach.


+------------------+--------------------------+----------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:          |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+------------------+--------------------------+----------------------------+


Home | Main Index | Thread Index | Old Index