Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Feb 2020 02:42:55 +0000 (UTC)
From:      Jeff Roberson <jeff@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357486 - head/sys/kern
Message-ID:  <202002040242.0142gthZ037585@repo.freebsd.org>

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



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