diff options
author | jhb <jhb@FreeBSD.org> | 2011-01-06 22:26:00 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2011-01-06 22:26:00 +0000 |
commit | 59c5693c6f3965052f235480bc07a20e6533d88e (patch) | |
tree | 1fab72aaac9980eb651239359d71f9a9e0c71c84 /sys/kern/kern_kthread.c | |
parent | 69d18cbe4f034ea7a15bb41a81bb2c3540f77d00 (diff) | |
download | FreeBSD-src-59c5693c6f3965052f235480bc07a20e6533d88e.zip FreeBSD-src-59c5693c6f3965052f235480bc07a20e6533d88e.tar.gz |
- 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
Diffstat (limited to 'sys/kern/kern_kthread.c')
-rw-r--r-- | sys/kern/kern_kthread.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index 6794200..95f896f 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; } |