summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorBret Lambert <blambert@cvs.openbsd.org>2014-10-08 15:28:40 +0000
committerBret Lambert <blambert@cvs.openbsd.org>2014-10-08 15:28:40 +0000
commit9fa043c8e1549a9b456ffedf7eadcea72e0dc4c5 (patch)
tree91b6d62b20c73e6a8dee11c641ad06fb8a310e79 /sys/kern
parentf5ce82e96176f3bab796174e6f0a2cb21bea4a9d (diff)
make workq/taskq runner threads yield when they've hogged the cpu
ok deraadt@ dlg@ phessler@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_task.c6
-rw-r--r--sys/kern/kern_workq.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/kern_task.c b/sys/kern/kern_task.c
index b685ce888e2..39f17370b32 100644
--- a/sys/kern/kern_task.c
+++ b/sys/kern/kern_task.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_task.c,v 1.10 2014/07/12 18:43:32 tedu Exp $ */
+/* $OpenBSD: kern_task.c,v 1.11 2014/10/08 15:28:39 blambert Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
@@ -261,8 +261,10 @@ taskq_thread(void *xtq)
if (tq->tq_unlocked)
KERNEL_UNLOCK();
- while (taskq_next_work(tq, &work))
+ while (taskq_next_work(tq, &work)) {
(*work.t_func)(work.t_arg1, work.t_arg2);
+ sched_pause();
+ }
mtx_enter(&tq->tq_mtx);
last = (--tq->tq_running == 0);
diff --git a/sys/kern/kern_workq.c b/sys/kern/kern_workq.c
index a019620ab1c..9aabaf7249e 100644
--- a/sys/kern/kern_workq.c
+++ b/sys/kern/kern_workq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_workq.c,v 1.15 2014/07/12 18:43:32 tedu Exp $ */
+/* $OpenBSD: kern_workq.c,v 1.16 2014/10/08 15:28:39 blambert Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -236,6 +236,7 @@ workq_thread(void *arg)
wqt->wqt_func(wqt->wqt_arg1, wqt->wqt_arg2);
if (mypool)
pool_put(&workq_task_pool, wqt);
+ sched_pause();
}
kthread_exit(0);