summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-03-17 09:59:02 -0300
committerRenato Botelho <renato@netgate.com>2016-03-17 09:59:02 -0300
commit26579e8947bb764387ecc9b47dbe846b8eb476a4 (patch)
tree1a160679cf6b42ac86e8a46428b72718516eda5a /sys/kern
parenta26e4b3de35515ec3eaf2eb76b001a6a502bf56c (diff)
parent5c5f0dbf8c72e3f9756938b33922f00eda1decd8 (diff)
downloadFreeBSD-src-26579e8947bb764387ecc9b47dbe846b8eb476a4.zip
FreeBSD-src-26579e8947bb764387ecc9b47dbe846b8eb476a4.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_timeout.c10
-rw-r--r--sys/kern/subr_sleepqueue.c3
2 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
index c3a2226..a3402f8 100644
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -1114,9 +1114,9 @@ callout_schedule(struct callout *c, int to_ticks)
}
int
-_callout_stop_safe(c, safe)
+_callout_stop_safe(c, flags)
struct callout *c;
- int safe;
+ int flags;
{
struct callout_cpu *cc, *old_cc;
struct lock_class *class;
@@ -1127,7 +1127,7 @@ _callout_stop_safe(c, safe)
* Some old subsystems don't hold Giant while running a callout_stop(),
* so just discard this check for the moment.
*/
- if (!safe && c->c_lock != NULL) {
+ if ((flags & CS_DRAIN) == 0 && c->c_lock != NULL) {
if (c->c_lock == &Giant.lock_object)
use_lock = mtx_owned(&Giant);
else {
@@ -1207,7 +1207,7 @@ again:
return (0);
}
- if (safe) {
+ if ((flags & CS_DRAIN) != 0) {
/*
* The current callout is running (or just
* about to run) and blocking is allowed, so
@@ -1319,7 +1319,7 @@ again:
CTR3(KTR_CALLOUT, "postponing stop %p func %p arg %p",
c, c->c_func, c->c_arg);
CC_UNLOCK(cc);
- return (0);
+ return ((flags & CS_MIGRBLOCK) != 0);
}
CTR3(KTR_CALLOUT, "failed to stop %p func %p arg %p",
c, c->c_func, c->c_arg);
diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c
index d4ae25f..c490460 100644
--- a/sys/kern/subr_sleepqueue.c
+++ b/sys/kern/subr_sleepqueue.c
@@ -572,7 +572,8 @@ sleepq_check_timeout(void)
* another CPU, so synchronize with it to avoid having it
* accidentally wake up a subsequent sleep.
*/
- else if (callout_stop(&td->td_slpcallout) == 0) {
+ else if (_callout_stop_safe(&td->td_slpcallout, CS_MIGRBLOCK)
+ == 0) {
td->td_flags |= TDF_TIMEOUT;
TD_SET_SLEEPING(td);
mi_switch(SW_INVOL | SWT_SLEEPQTIMO, NULL);
OpenPOWER on IntegriCloud