svn commit: r291403 - head/sys/boot/kshim
Zbigniew Bodek
zbb at FreeBSD.org
Fri Nov 27 18:19:13 UTC 2015
Author: zbb
Date: Fri Nov 27 18:19:11 2015
New Revision: 291403
URL: https://svnweb.freebsd.org/changeset/base/291403
Log:
Run callouts during infinite waiting inside cv_wait
During cv_wait we may be waiting for an event triggered by callout.
Run callbacks here to avoid code blocking.
Reviewed by: hselasky
Submitted by: Wojciech Macek <wma at semihalf.com>
Obtained from: Semihalf
Sponsored by: Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4144
Modified:
head/sys/boot/kshim/bsd_kernel.c
Modified: head/sys/boot/kshim/bsd_kernel.c
==============================================================================
--- head/sys/boot/kshim/bsd_kernel.c Fri Nov 27 18:17:53 2015 (r291402)
+++ head/sys/boot/kshim/bsd_kernel.c Fri Nov 27 18:19:11 2015 (r291403)
@@ -138,6 +138,7 @@ cv_timedwait(struct cv *cv, struct mtx *
{
int start = ticks;
int delta;
+ int time = 0;
if (cv->sleeping)
return (EWOULDBLOCK); /* not allowed */
@@ -154,6 +155,14 @@ cv_timedwait(struct cv *cv, struct mtx *
usb_idle();
+ if (++time >= (1000000 / hz)) {
+ time = 0;
+ callout_process(1);
+ }
+
+ /* Sleep for 1 us */
+ delay(1);
+
mtx_lock(mtx);
}
More information about the svn-src-head
mailing list