Module Name: src Committed By: riastradh Date: Wed Aug 9 08:23:13 UTC 2023
Modified Files: src/sys/kern: subr_workqueue.c src/tests/rump/rumpkern: t_workqueue.c Log Message: workqueue(9): Avoid touching running work items in workqueue_wait. As soon as the workqueue function has called, it is forbidden to touch the struct work passed to it -- the function might free or reuse the data structure it is embedded in. So workqueue_wait is forbidden to search the queue for the batch of running work items. Instead, use a generation number which is odd while the thread is processing a batch of work and even when not. There's still a small optimization available with the struct work pointer to wait for: if we find the work item in one of the per-CPU _pending_ queues, then after we wait for a batch of work to complete on that CPU, we don't need to wait for work on any other CPUs. PR kern/57574 XXX pullup-10 XXX pullup-9 XXX pullup-8 To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/kern/subr_workqueue.c cvs rdiff -u -r1.3 -r1.4 src/tests/rump/rumpkern/t_workqueue.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.