diff options
author | Jeff Roberson <jeff@FreeBSD.org> | 2007-09-17 05:31:39 +0000 |
---|---|---|
committer | Jeff Roberson <jeff@FreeBSD.org> | 2007-09-17 05:31:39 +0000 |
commit | b61ce5b0e6aad0a00038c9c40f29a7de3646e3fe (patch) | |
tree | e572a7b77f24339d2dc6ebf6b83c1e2c1ce0f6a5 /sys/kern/kern_synch.c | |
parent | 0e8c5adf211ae3a5e3ab19d96ca3a01d03210125 (diff) | |
download | src-b61ce5b0e6aad0a00038c9c40f29a7de3646e3fe.tar.gz src-b61ce5b0e6aad0a00038c9c40f29a7de3646e3fe.zip |
- Move all of the PS_ flags into either p_flag or td_flags.
- p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or
previously the sched_lock. These bugs have existed for some time.
- Allow swapout to try each thread in a process individually and then
swapin the whole process if any of these fail. This allows us to move
most scheduler related swap flags into td_flags.
- Keep ki_sflag for backwards compat but change all in source tools to
use the new and more correct location of P_INMEM.
Reported by: pho
Reviewed by: attilio, kib
Approved by: re (kensmith)
Notes
Notes:
svn path=/head/; revision=172207
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r-- | sys/kern/kern_synch.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 96b4edaa189f..8cdd9fe14d75 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -463,16 +463,10 @@ mi_switch(int flags, struct thread *newtd) void setrunnable(struct thread *td) { - struct proc *p; - p = td->td_proc; THREAD_LOCK_ASSERT(td, MA_OWNED); - switch (p->p_state) { - case PRS_ZOMBIE: - panic("setrunnable(1)"); - default: - break; - } + KASSERT(td->td_proc->p_state != PRS_ZOMBIE, + ("setrunnable: pid %d is a zombie", td->td_proc->p_pid)); switch (td->td_state) { case TDS_RUNNING: case TDS_RUNQ: @@ -491,9 +485,9 @@ setrunnable(struct thread *td) printf("state is 0x%x", td->td_state); panic("setrunnable(2)"); } - if ((p->p_sflag & PS_INMEM) == 0) { - if ((p->p_sflag & PS_SWAPPINGIN) == 0) { - p->p_sflag |= PS_SWAPINREQ; + if ((td->td_flags & TDF_INMEM) == 0) { + if ((td->td_flags & TDF_SWAPINREQ) == 0) { + td->td_flags |= TDF_SWAPINREQ; /* * due to a LOR between the thread lock and * the sleepqueue chain locks, use |