Don't skimp on the last batch of work when worker is dying.

This is capitalism.  We can't afford to waste time the worker could
spend on labour even if we work 'em to death!
This commit is contained in:
riastradh 2018-08-27 15:07:44 +00:00
parent 077afc9a15
commit 70435d9314
1 changed files with 7 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_work.c,v 1.41 2018/08/27 15:06:37 riastradh Exp $ */
/* $NetBSD: linux_work.c,v 1.42 2018/08/27 15:07:44 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.41 2018/08/27 15:06:37 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.42 2018/08/27 15:07:44 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
@ -333,14 +333,12 @@ linux_workqueue_thread(void *cookie)
* Wait until there's activity. If there's no work and
* we're dying, stop here.
*/
while (TAILQ_EMPTY(&wq->wq_queue) &&
TAILQ_EMPTY(&wq->wq_dqueue) &&
!wq->wq_dying)
if (TAILQ_EMPTY(&wq->wq_queue) &&
TAILQ_EMPTY(&wq->wq_dqueue)) {
if (wq->wq_dying)
break;
cv_wait(&wq->wq_cv, &wq->wq_lock);
if (wq->wq_dying) {
KASSERT(TAILQ_EMPTY(&wq->wq_queue));
KASSERT(TAILQ_EMPTY(&wq->wq_dqueue));
break;
continue;
}
/* Grab a batch of work off the queue. */