Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Oct 2019 21:55:19 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354052 - head/sys/kern
Message-ID:  <201910242155.x9OLtJjJ002532@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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"));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910242155.x9OLtJjJ002532>