Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/common/linux Don't skimp on the last batch ...



details:   https://anonhg.NetBSD.org/src/rev/381220a46b88
branches:  trunk
changeset: 366375:381220a46b88
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 15:07:44 2018 +0000

description:
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!

diffstat:

 sys/external/bsd/common/linux/linux_work.c |  16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diffs (38 lines):

diff -r 59a3c190095f -r 381220a46b88 sys/external/bsd/common/linux/linux_work.c
--- a/sys/external/bsd/common/linux/linux_work.c        Mon Aug 27 15:07:29 2018 +0000
+++ b/sys/external/bsd/common/linux/linux_work.c        Mon Aug 27 15:07:44 2018 +0000
@@ -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 @@
                 * 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.  */



Home | Main Index | Thread Index | Old Index