svn commit: r357486 - head/sys/kern

Jeff Roberson jeff at FreeBSD.org
Tue Feb 4 02:42:55 UTC 2020


Author: jeff
Date: Tue Feb  4 02:42:54 2020
New Revision: 357486
URL: https://svnweb.freebsd.org/changeset/base/357486

Log:
  Fix a recursion on the thread lock by acquiring it after call rtp_to_pri().
  
  Reported by:	swills
  Reviewed by:	kib, markj
  Differential Revision:	https://reviews.freebsd.org/D23495

Modified:
  head/sys/kern/kern_thr.c

Modified: head/sys/kern/kern_thr.c
==============================================================================
--- head/sys/kern/kern_thr.c	Tue Feb  4 02:41:24 2020	(r357485)
+++ head/sys/kern/kern_thr.c	Tue Feb  4 02:42:54 2020	(r357486)
@@ -271,14 +271,12 @@ thread_create(struct thread *td, struct rtprio *rtp,
 
 	tidhash_add(newtd);
 
+	/* ignore timesharing class */
+	if (rtp != NULL && !(td->td_pri_class == PRI_TIMESHARE &&
+	    rtp->type == RTP_PRIO_NORMAL))
+		rtp_to_pri(rtp, newtd);
+
 	thread_lock(newtd);
-	if (rtp != NULL) {
-		if (!(td->td_pri_class == PRI_TIMESHARE &&
-		      rtp->type == RTP_PRIO_NORMAL)) {
-			rtp_to_pri(rtp, newtd);
-			sched_prio(newtd, newtd->td_user_pri);
-		} /* ignore timesharing class */
-	}
 	TD_SET_CAN_RUN(newtd);
 	sched_add(newtd, SRQ_BORING);
 


More information about the svn-src-all mailing list