diff options
author | jhb <jhb@FreeBSD.org> | 2011-01-06 22:24:00 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2011-01-06 22:24:00 +0000 |
commit | 69d18cbe4f034ea7a15bb41a81bb2c3540f77d00 (patch) | |
tree | 61f6474d4e7ec8034e7d80fbded69ce4f81a66d7 /sys/kern/sched_4bsd.c | |
parent | 13ffed6f87677b4fbfe9b4c0a700500ce67db7c7 (diff) | |
download | FreeBSD-src-69d18cbe4f034ea7a15bb41a81bb2c3540f77d00.zip FreeBSD-src-69d18cbe4f034ea7a15bb41a81bb2c3540f77d00.tar.gz |
- Move sched_fork() later in fork() after the various sections of the new
thread and proc have been copied and zeroed from the old thread and
proc. Otherwise attempts to modify thread or process data in sched_fork()
could be undone.
- Don't copy td_{base,}_user_pri from the old thread to the new thread in
sched_fork_thread() in ULE. This is already done courtesy the bcopy()
of the thread copy region.
- Always initialize the real priority (td_priority) of new threads to the
new thread's base priority (td_base_pri) to avoid bogusly inheriting a
borrowed priority from the parent thread.
MFC after: 2 weeks
Diffstat (limited to 'sys/kern/sched_4bsd.c')
-rw-r--r-- | sys/kern/sched_4bsd.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 596102f..0dc2973 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -759,6 +759,7 @@ sched_fork_thread(struct thread *td, struct thread *childtd) childtd->td_estcpu = td->td_estcpu; childtd->td_lock = &sched_lock; childtd->td_cpuset = cpuset_ref(td->td_cpuset); + childtd->td_priority = childtd->td_base_pri; ts = childtd->td_sched; bzero(ts, sizeof(*ts)); ts->ts_flags |= (td->td_sched->ts_flags & TSF_AFFINITY); |