Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Take the ASSERT_SLEEPABLE() out of threadpool_cance...



details:   https://anonhg.NetBSD.org/src/rev/f44aafe8e01f
branches:  trunk
changeset: 931296:f44aafe8e01f
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Apr 25 17:43:23 2020 +0000

description:
Take the ASSERT_SLEEPABLE() out of threadpool_cancel_job() and add a
comment explaining why we can't make that assertion there.

diffstat:

 sys/kern/kern_threadpool.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 74ad5c4449c8 -r f44aafe8e01f sys/kern/kern_threadpool.c
--- a/sys/kern/kern_threadpool.c        Sat Apr 25 16:10:06 2020 +0000
+++ b/sys/kern/kern_threadpool.c        Sat Apr 25 17:43:23 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_threadpool.c,v 1.17 2020/02/09 22:57:39 riastradh Exp $   */
+/*     $NetBSD: kern_threadpool.c,v 1.18 2020/04/25 17:43:23 thorpej Exp $     */
 
 /*-
  * Copyright (c) 2014, 2018 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.17 2020/02/09 22:57:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.18 2020/04/25 17:43:23 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -933,7 +933,12 @@
 threadpool_cancel_job(struct threadpool *pool, struct threadpool_job *job)
 {
 
-       ASSERT_SLEEPABLE();
+       /*
+        * We may sleep here, but we can't ASSERT_SLEEPABLE() because
+        * the job lock (used to interlock the cv_wait()) may in fact
+        * legitimately be a spin lock, so the assertion would fire
+        * as a false-positive.
+        */
 
        KASSERT(mutex_owned(job->job_lock));
 



Home | Main Index | Thread Index | Old Index