Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Don't wait on workqueue_wait if called from worker ...



details:   https://anonhg.NetBSD.org/src/rev/34a9bcae8e05
branches:  trunk
changeset: 319830:34a9bcae8e05
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Jun 13 05:26:12 2018 +0000

description:
Don't wait on workqueue_wait if called from worker itself

Otherwise workqueue_wait never return in such a case.  This treatment
is the same as callout_halt.

diffstat:

 sys/kern/subr_workqueue.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 5612c72cf82e -r 34a9bcae8e05 sys/kern/subr_workqueue.c
--- a/sys/kern/subr_workqueue.c Wed Jun 13 04:21:21 2018 +0000
+++ b/sys/kern/subr_workqueue.c Wed Jun 13 05:26:12 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_workqueue.c,v 1.36 2018/02/06 03:48:39 ozaki-r Exp $      */
+/*     $NetBSD: subr_workqueue.c,v 1.37 2018/06/13 05:26:12 ozaki-r Exp $      */
 
 /*-
  * Copyright (c)2002, 2005, 2006, 2007 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_workqueue.c,v 1.36 2018/02/06 03:48:39 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_workqueue.c,v 1.37 2018/06/13 05:26:12 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -287,6 +287,8 @@
        bool found = false;
 
        mutex_enter(&q->q_mutex);
+       if (q->q_worker == curlwp)
+               goto out;
     again:
        SIMPLEQ_FOREACH(wk, &q->q_queue_pending, wk_entry) {
                if (wk == wk_target)
@@ -306,6 +308,7 @@
        }
        if (q->q_waiter != NULL)
                q->q_waiter = NULL;
+    out:
        mutex_exit(&q->q_mutex);
 
        return found;



Home | Main Index | Thread Index | Old Index