aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/sched_ule.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2011-01-06 22:24:00 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2011-01-06 22:24:00 +0000
commit22d19207e9830cc42b89f2e36aef61a1eea835be (patch)
tree61f6474d4e7ec8034e7d80fbded69ce4f81a66d7 /sys/kern/sched_ule.c
parent177499ebcc0aa354bbf8e560921833129027e1a9 (diff)
downloadsrc-22d19207e9830cc42b89f2e36aef61a1eea835be.tar.gz
src-22d19207e9830cc42b89f2e36aef61a1eea835be.zip
- Move sched_fork() later in fork() after the various sections of the new
thread and proc have been copied and zeroed from the old thread and proc. Otherwise attempts to modify thread or process data in sched_fork() could be undone. - Don't copy td_{base,}_user_pri from the old thread to the new thread in sched_fork_thread() in ULE. This is already done courtesy the bcopy() of the thread copy region. - Always initialize the real priority (td_priority) of new threads to the new thread's base priority (td_base_pri) to avoid bogusly inheriting a borrowed priority from the parent thread. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=217078
Diffstat (limited to 'sys/kern/sched_ule.c')
-rw-r--r--sys/kern/sched_ule.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index a5a8d1b0d44e..bee04749898f 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -1961,14 +1961,16 @@ sched_fork_thread(struct thread *td, struct thread *child)
ts2->ts_cpu = ts->ts_cpu;
ts2->ts_flags = 0;
/*
- * Grab our parents cpu estimation information and priority.
+ * Grab our parents cpu estimation information.
*/
ts2->ts_ticks = ts->ts_ticks;
ts2->ts_ltick = ts->ts_ltick;
ts2->ts_incrtick = ts->ts_incrtick;
ts2->ts_ftick = ts->ts_ftick;
- child->td_user_pri = td->td_user_pri;
- child->td_base_user_pri = td->td_base_user_pri;
+ /*
+ * Do not inherit any borrowed priority from the parent.
+ */
+ child->td_priority = child->td_base_pri;
/*
* And update interactivity score.
*/