1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

Add lock assertions for various proc/thread/kse/ksegroup fields to the

scheduler functions.
This commit is contained in:
John Baldwin 2003-04-23 18:51:05 +00:00
parent 5afe0c9947
commit 2056d0a168
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113923
2 changed files with 16 additions and 0 deletions

View File

@ -441,6 +441,7 @@ sched_clock(struct kse *ke)
struct ksegrp *kg;
struct thread *td;
mtx_assert(&sched_lock, MA_OWNED);
kg = ke->ke_ksegrp;
td = ke->ke_thread;
@ -476,6 +477,8 @@ sched_exit_kse(struct kse *ke, struct kse *child)
void
sched_exit_ksegrp(struct ksegrp *kg, struct ksegrp *child)
{
mtx_assert(&sched_lock, MA_OWNED);
kg->kg_estcpu = ESTCPULIM(kg->kg_estcpu + child->kg_estcpu);
}
@ -501,6 +504,7 @@ sched_fork_kse(struct kse *ke, struct kse *child)
void
sched_fork_ksegrp(struct ksegrp *kg, struct ksegrp *child)
{
mtx_assert(&sched_lock, MA_OWNED);
child->kg_estcpu = kg->kg_estcpu;
}
@ -522,6 +526,7 @@ sched_nice(struct ksegrp *kg, int nice)
void
sched_class(struct ksegrp *kg, int class)
{
mtx_assert(&sched_lock, MA_OWNED);
kg->kg_pri_class = class;
}
@ -535,6 +540,7 @@ void
sched_prio(struct thread *td, u_char prio)
{
mtx_assert(&sched_lock, MA_OWNED);
if (TD_ON_RUNQ(td)) {
adjustrunqueue(td, prio);
} else {
@ -545,6 +551,8 @@ sched_prio(struct thread *td, u_char prio)
void
sched_sleep(struct thread *td, u_char prio)
{
mtx_assert(&sched_lock, MA_OWNED);
td->td_ksegrp->kg_slptime = 0;
td->td_priority = prio;
}
@ -552,6 +560,8 @@ sched_sleep(struct thread *td, u_char prio)
void
sched_switchin(struct thread *td)
{
mtx_assert(&sched_lock, MA_OWNED);
td->td_oncpu = PCPU_GET(cpuid);
}
@ -564,6 +574,7 @@ sched_switchout(struct thread *td)
ke = td->td_kse;
p = td->td_proc;
mtx_assert(&sched_lock, MA_OWNED);
KASSERT((ke->ke_state == KES_THREAD), ("mi_switch: kse state?"));
td->td_lastcpu = td->td_oncpu;
@ -593,6 +604,7 @@ sched_wakeup(struct thread *td)
{
struct ksegrp *kg;
mtx_assert(&sched_lock, MA_OWNED);
kg = td->td_ksegrp;
if (kg->kg_slptime > 1)
updatepri(kg);

View File

@ -769,6 +769,7 @@ sched_fork(struct proc *p, struct proc *p1)
void
sched_fork_kse(struct kse *ke, struct kse *child)
{
child->ke_slice = ke->ke_slice;
child->ke_cpu = ke->ke_cpu; /* sched_pickcpu(); */
child->ke_runq = NULL;
@ -785,6 +786,8 @@ sched_fork_kse(struct kse *ke, struct kse *child)
void
sched_fork_ksegrp(struct ksegrp *kg, struct ksegrp *child)
{
PROC_LOCK_ASSERT(child->kg_proc, MA_OWNED);
/* XXX Need something better here */
if (kg->kg_slptime > kg->kg_runtime) {
child->kg_slptime = SCHED_DYN_RANGE;
@ -809,6 +812,7 @@ sched_class(struct ksegrp *kg, int class)
struct kseq *kseq;
struct kse *ke;
mtx_assert(&sched_lock, MA_OWNED);
if (kg->kg_pri_class == class)
return;