svn commit: r354052 - head/sys/kern

Gleb Smirnoff glebius at FreeBSD.org
Thu Oct 24 21:55:20 UTC 2019


Author: glebius
Date: Thu Oct 24 21:55:19 2019
New Revision: 354052
URL: https://svnweb.freebsd.org/changeset/base/354052

Log:
  Use THREAD_CAN_SLEEP() macro to check if thread can sleep.  There is no
  functional change.
  
  Discussed with:	kib

Modified:
  head/sys/kern/subr_sleepqueue.c
  head/sys/kern/subr_trap.c

Modified: head/sys/kern/subr_sleepqueue.c
==============================================================================
--- head/sys/kern/subr_sleepqueue.c	Thu Oct 24 21:43:01 2019	(r354051)
+++ head/sys/kern/subr_sleepqueue.c	Thu Oct 24 21:55:19 2019	(r354052)
@@ -315,7 +315,7 @@ sleepq_add(void *wchan, struct lock_object *lock, cons
 	MPASS((queue >= 0) && (queue < NR_SLEEPQS));
 
 	/* If this thread is not allowed to sleep, die a horrible death. */
-	KASSERT(td->td_no_sleeping == 0,
+	KASSERT(THREAD_CAN_SLEEP(),
 	    ("%s: td %p to sleep on wchan %p with sleeping prohibited",
 	    __func__, td, wchan));
 

Modified: head/sys/kern/subr_trap.c
==============================================================================
--- head/sys/kern/subr_trap.c	Thu Oct 24 21:43:01 2019	(r354051)
+++ head/sys/kern/subr_trap.c	Thu Oct 24 21:55:19 2019	(r354052)
@@ -185,7 +185,7 @@ userret(struct thread *td, struct trapframe *frame)
 	    td->td_lk_slocks));
 	KASSERT((td->td_pflags & TDP_NOFAULTING) == 0,
 	    ("userret: Returning with pagefaults disabled"));
-	KASSERT(td->td_no_sleeping == 0,
+	KASSERT(THREAD_CAN_SLEEP(),
 	    ("userret: Returning with sleep disabled"));
 	KASSERT(td->td_pinned == 0 || (td->td_pflags & TDP_CALLCHAIN) != 0,
 	    ("userret: Returning with with pinned thread"));


More information about the svn-src-all mailing list