svn commit: r319312 - head/sys/compat/linuxkpi/common/src
Hans Petter Selasky
hselasky at FreeBSD.org
Wed May 31 10:01:16 UTC 2017
Author: hselasky
Date: Wed May 31 10:01:15 2017
New Revision: 319312
URL: https://svnweb.freebsd.org/changeset/base/319312
Log:
Make sure the thread's priority is restored for all three cases inside
linux_synchronize_rcu_cb() in the LinuxKPI.
MFC after: 1 week
Sponsored by: Mellanox Technologies
Modified:
head/sys/compat/linuxkpi/common/src/linux_rcu.c
Modified: head/sys/compat/linuxkpi/common/src/linux_rcu.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_rcu.c Wed May 31 09:25:47 2017 (r319311)
+++ head/sys/compat/linuxkpi/common/src/linux_rcu.c Wed May 31 10:01:15 2017 (r319312)
@@ -236,7 +236,6 @@ linux_synchronize_rcu_cb(ck_epoch_t *epoch __unused, c
if (record->cpuid == PCPU_GET(cpuid)) {
bool is_sleeping = 0;
u_char prio = 0;
- u_char old_prio;
/*
* Find the lowest priority or sleeping thread which
@@ -255,13 +254,10 @@ linux_synchronize_rcu_cb(ck_epoch_t *epoch __unused, c
pause("W", 1);
thread_lock(td);
} else {
- old_prio = td->td_priority;
/* set new thread priority */
sched_prio(td, prio);
/* task switch */
mi_switch(SW_VOL | SWT_RELINQUISH, NULL);
- /* restore thread priority */
- sched_prio(td, old_prio);
}
} else {
/*
@@ -282,6 +278,7 @@ linux_synchronize_rcu(void)
int was_bound;
int old_cpu;
int old_pinned;
+ u_char old_prio;
if (RCU_SKIP())
return;
@@ -301,6 +298,7 @@ linux_synchronize_rcu(void)
old_cpu = PCPU_GET(cpuid);
old_pinned = td->td_pinned;
+ old_prio = td->td_priority;
td->td_pinned = 0;
was_bound = sched_is_bound(td);
sched_bind(td, old_cpu);
@@ -319,6 +317,9 @@ linux_synchronize_rcu(void)
}
/* restore pinned after bind */
td->td_pinned = old_pinned;
+
+ /* restore thread priority */
+ sched_prio(td, old_prio);
thread_unlock(td);
PICKUP_GIANT();
More information about the svn-src-head
mailing list