- 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
This commit is contained in:
John Baldwin 2011-01-06 22:26:00 +00:00
parent 22d19207e9
commit fd05807822
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=217079
2 changed files with 6 additions and 5 deletions

View File

@ -462,7 +462,7 @@ proc0_init(void *dummy __unused)
td->td_base_user_pri = PUSER;
td->td_lend_user_pri = PRI_MAX;
td->td_priority = PVM;
td->td_base_pri = PUSER;
td->td_base_pri = PVM;
td->td_oncpu = 0;
td->td_flags = TDF_INMEM|TDP_KTHREAD;
td->td_cpuset = cpuset_thread0();

View File

@ -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;
}