aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_kthread.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2011-01-06 22:26:00 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2011-01-06 22:26:00 +0000
commitfd05807822747642daef436c4755f306c5d5fd83 (patch)
tree1fab72aaac9980eb651239359d71f9a9e0c71c84 /sys/kern/kern_kthread.c
parent22d19207e9830cc42b89f2e36aef61a1eea835be (diff)
downloadsrc-fd05807822747642daef436c4755f306c5d5fd83.tar.gz
src-fd05807822747642daef436c4755f306c5d5fd83.zip
- Properly initialize the base priority (td_base_pri) of thread0 to PVM
to match the desired priority in td_priority. Otherwise the first time thread0 used a borrowed priority it would drop down to PUSER instead of PVM. - Explicitly initialize the starting priority of new kprocs to PVM to avoid inheriting some random priority from thread0. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=217079
Diffstat (limited to 'sys/kern/kern_kthread.c')
-rw-r--r--sys/kern/kern_kthread.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c
index 679420012aac..95f896fa5aa6 100644
--- a/sys/kern/kern_kthread.c
+++ b/sys/kern/kern_kthread.c
@@ -117,14 +117,15 @@ kproc_create(void (*func)(void *), void *arg,
/* call the processes' main()... */
cpu_set_fork_handler(td, func, arg);
+ thread_lock(td);
TD_SET_CAN_RUN(td);
+ sched_prio(td, PVM);
+ sched_user_prio(td, PUSER);
/* Delay putting it on the run queue until now. */
- if (!(flags & RFSTOPPED)) {
- thread_lock(td);
+ if (!(flags & RFSTOPPED))
sched_add(td, SRQ_BORING);
- thread_unlock(td);
- }
+ thread_unlock(td);
return 0;
}