diff options
author | julian <julian@FreeBSD.org> | 2004-07-18 23:36:13 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2004-07-18 23:36:13 +0000 |
commit | a488bebcd21f1e39697ac09fdac970a06d6fb621 (patch) | |
tree | 548243b8828b679ca121764ef843b623c31cf5b9 /sys/kern/sched_4bsd.c | |
parent | d538dc62fd30a8ac9beb2f57ffc4321e42569aab (diff) | |
download | FreeBSD-src-a488bebcd21f1e39697ac09fdac970a06d6fb621.zip FreeBSD-src-a488bebcd21f1e39697ac09fdac970a06d6fb621.tar.gz |
When calling scheduler entrypoints for creating new threads and processes,
specify "us" as the thread not the process/ksegrp/kse.
You can always find the others from the thread but the converse is not true.
Theorotically this would lead to runtime being allocated to the wrong
entity in some cases though it is not clear how often this actually happenned.
(would only affect threaded processes and would probably be pretty benign,
but it WAS a bug..)
Reviewed by: peter
Diffstat (limited to 'sys/kern/sched_4bsd.c')
-rw-r--r-- | sys/kern/sched_4bsd.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index c80214e..4bff511 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -536,24 +536,24 @@ sched_clock(struct thread *td) * aggregated all the estcpu into the 'built-in' ksegrp. */ void -sched_exit(struct proc *p, struct proc *p1) +sched_exit(struct proc *p, struct thread *td) { - sched_exit_kse(FIRST_KSE_IN_PROC(p), FIRST_KSE_IN_PROC(p1)); - sched_exit_ksegrp(FIRST_KSEGRP_IN_PROC(p), FIRST_KSEGRP_IN_PROC(p1)); - sched_exit_thread(FIRST_THREAD_IN_PROC(p), FIRST_THREAD_IN_PROC(p1)); + sched_exit_kse(FIRST_KSE_IN_PROC(p), td); + sched_exit_ksegrp(FIRST_KSEGRP_IN_PROC(p), td); + sched_exit_thread(FIRST_THREAD_IN_PROC(p), td); } void -sched_exit_kse(struct kse *ke, struct kse *child) +sched_exit_kse(struct kse *ke, struct thread *child) { } void -sched_exit_ksegrp(struct ksegrp *kg, struct ksegrp *child) +sched_exit_ksegrp(struct ksegrp *kg, struct thread *childtd) { mtx_assert(&sched_lock, MA_OWNED); - kg->kg_estcpu = ESTCPULIM(kg->kg_estcpu + child->kg_estcpu); + kg->kg_estcpu = ESTCPULIM(kg->kg_estcpu + childtd->td_ksegrp->kg_estcpu); } void @@ -564,24 +564,24 @@ sched_exit_thread(struct thread *td, struct thread *child) } void -sched_fork(struct proc *p, struct proc *p1) +sched_fork(struct thread *td, struct proc *p1) { - sched_fork_kse(FIRST_KSE_IN_PROC(p), FIRST_KSE_IN_PROC(p1)); - sched_fork_ksegrp(FIRST_KSEGRP_IN_PROC(p), FIRST_KSEGRP_IN_PROC(p1)); - sched_fork_thread(FIRST_THREAD_IN_PROC(p), FIRST_THREAD_IN_PROC(p1)); + sched_fork_kse(td, FIRST_KSE_IN_PROC(p1)); + sched_fork_ksegrp(td, FIRST_KSEGRP_IN_PROC(p1)); + sched_fork_thread(td, FIRST_THREAD_IN_PROC(p1)); } void -sched_fork_kse(struct kse *ke, struct kse *child) +sched_fork_kse(struct thread *td, struct kse *child) { child->ke_sched->ske_cpticks = 0; } void -sched_fork_ksegrp(struct ksegrp *kg, struct ksegrp *child) +sched_fork_ksegrp(struct thread *td, struct ksegrp *child) { mtx_assert(&sched_lock, MA_OWNED); - child->kg_estcpu = kg->kg_estcpu; + child->kg_estcpu = td->td_ksegrp->kg_estcpu; } void |