Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 May 2018 19:08:28 +0000 (UTC)
From:      Matt Macy <mmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r333755 - head/sys/kern
Message-ID:  <201805171908.w4HJ8SHO007826@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmacy
Date: Thu May 17 19:08:28 2018
New Revision: 333755
URL: https://svnweb.freebsd.org/changeset/base/333755

Log:
  epoch(9): restore thread priority on exit if it was changed by a waiter
  
  Reported by:	markj
  Approved by:	sbruno

Modified:
  head/sys/kern/subr_epoch.c

Modified: head/sys/kern/subr_epoch.c
==============================================================================
--- head/sys/kern/subr_epoch.c	Thu May 17 19:06:44 2018	(r333754)
+++ head/sys/kern/subr_epoch.c	Thu May 17 19:08:28 2018	(r333755)
@@ -290,6 +290,7 @@ epoch_enter_internal(epoch_t epoch, struct thread *td)
 
 	INIT_CHECK(epoch);
 	critical_enter();
+	td->td_pre_epoch_prio = td->td_priority;
 	eps = epoch->e_pcpu[curcpu];
 #ifdef INVARIANTS
 	MPASS(td->td_epochnest < UCHAR_MAX - 2);
@@ -326,6 +327,11 @@ epoch_exit_internal(epoch_t epoch, struct thread *td)
 	TAILQ_REMOVE(&eps->eps_record.er_tdlist, td, td_epochq);
 	eps->eps_record.er_gen++;
 	sched_unpin();
+	if (__predict_false(td->td_pre_epoch_prio != td->td_priority)) {
+		thread_lock(td);
+		sched_prio(td, td->td_pre_epoch_prio);
+		thread_unlock(td);
+	}
 	critical_exit();
 }
 



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