svn commit: r217079 - head/sys/kern
John Baldwin
jhb at FreeBSD.org
Thu Jan 6 22:26:00 UTC 2011
Author: jhb
Date: Thu Jan 6 22:26:00 2011
New Revision: 217079
URL: http://svn.freebsd.org/changeset/base/217079
Log:
- 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
Modified:
head/sys/kern/init_main.c
head/sys/kern/kern_kthread.c
Modified: head/sys/kern/init_main.c
==============================================================================
--- head/sys/kern/init_main.c Thu Jan 6 22:24:00 2011 (r217078)
+++ head/sys/kern/init_main.c Thu Jan 6 22:26:00 2011 (r217079)
@@ -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();
Modified: head/sys/kern/kern_kthread.c
==============================================================================
--- head/sys/kern/kern_kthread.c Thu Jan 6 22:24:00 2011 (r217078)
+++ head/sys/kern/kern_kthread.c Thu Jan 6 22:26:00 2011 (r217079)
@@ -117,14 +117,15 @@ kproc_create(void (*func)(void *), void
/* 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;
}
More information about the svn-src-head
mailing list