PERFORCE change 129914 for review
Peter Wemm
peter at FreeBSD.org
Sat Dec 1 15:07:34 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=129914
Change 129914 by peter at peter_daintree on 2007/12/01 23:07:09
move common code
Affected files ...
.. //depot/projects/bike_sched/sys/kern/sched_4bsd.c#10 edit
.. //depot/projects/bike_sched/sys/kern/sched_ule.c#9 edit
.. //depot/projects/bike_sched/sys/kern/subr_trap.c#5 edit
Differences ...
==== //depot/projects/bike_sched/sys/kern/sched_4bsd.c#10 (text+ko) ====
@@ -1237,28 +1237,6 @@
}
void
-sched_userret(struct thread *td)
-{
- /*
- * XXX we cheat slightly on the locking here to avoid locking in
- * the usual case. Setting td_priority here is essentially an
- * incomplete workaround for not setting it properly elsewhere.
- * Now that some interrupt handlers are threads, not setting it
- * properly elsewhere can clobber it in the window between setting
- * it here and returning to user mode, so don't waste time setting
- * it perfectly here.
- */
- KASSERT((td->td_flags & TDF_BORROWING) == 0,
- ("thread with borrowed priority returning to userland"));
- if (td->td_priority != td->td_user_pri) {
- thread_lock(td);
- td->td_priority = td->td_user_pri;
- td->td_base_pri = td->td_user_pri;
- thread_unlock(td);
- }
-}
-
-void
sched_bind(struct thread *td, int cpu)
{
struct td_sched *ts;
==== //depot/projects/bike_sched/sys/kern/sched_ule.c#9 (text+ko) ====
@@ -2110,32 +2110,6 @@
}
/*
- * Fix priorities on return to user-space. Priorities may be elevated due
- * to static priorities in msleep() or similar.
- */
-void
-sched_userret(struct thread *td)
-{
- /*
- * XXX we cheat slightly on the locking here to avoid locking in
- * the usual case. Setting td_priority here is essentially an
- * incomplete workaround for not setting it properly elsewhere.
- * Now that some interrupt handlers are threads, not setting it
- * properly elsewhere can clobber it in the window between setting
- * it here and returning to user mode, so don't waste time setting
- * it perfectly here.
- */
- KASSERT((td->td_flags & TDF_BORROWING) == 0,
- ("thread with borrowed priority returning to userland"));
- if (td->td_priority != td->td_user_pri) {
- thread_lock(td);
- td->td_priority = td->td_user_pri;
- td->td_base_pri = td->td_user_pri;
- thread_unlock(td);
- }
-}
-
-/*
* Handle a stathz tick. This is really only relevant for timeshare
* threads.
*/
==== //depot/projects/bike_sched/sys/kern/subr_trap.c#5 (text+ko) ====
@@ -120,8 +120,26 @@
if (p->p_flag & P_PROFIL)
addupc_task(td, TRAPF_PC(frame), td->td_pticks * psratio);
+ /*
+ * Fix priorities on return to user-space. Priorities may be elevated due
+ * to static priorities in msleep() or similar.
+ *
+ * XXX we cheat slightly on the locking here to avoid locking in
+ * the usual case. Setting td_priority here is essentially an
+ * incomplete workaround for not setting it properly elsewhere.
+ * Now that some interrupt handlers are threads, not setting it
+ * properly elsewhere can clobber it in the window between setting
+ * it here and returning to user mode, so don't waste time setting
+ * it perfectly here.
+ */
KASSERT((td->td_flags & TDF_BORROWING) == 0,
("userret: thread with borrowed priority returning to userland"));
+ if (td->td_priority != td->td_user_pri) {
+ thread_lock(td);
+ td->td_priority = td->td_user_pri;
+ td->td_base_pri = td->td_user_pri;
+ thread_unlock(td);
+ }
KASSERT(td->td_locks == 0,
("userret: Returning with %d locks held.", td->td_locks));
}
More information about the p4-projects
mailing list