diff options
author | tanimura <tanimura@FreeBSD.org> | 2002-07-30 06:54:05 +0000 |
---|---|---|
committer | tanimura <tanimura@FreeBSD.org> | 2002-07-30 06:54:05 +0000 |
commit | 8eb7238cade123cbd553b5d57bbb5117f538adbb (patch) | |
tree | 0c83be03d1e2e71dfad7f8b959ebd86dd9b9546f /sys/kern/kern_synch.c | |
parent | 18acb2ea275ccf40f6db01964cd3438104000486 (diff) | |
download | FreeBSD-src-8eb7238cade123cbd553b5d57bbb5117f538adbb.zip FreeBSD-src-8eb7238cade123cbd553b5d57bbb5117f538adbb.tar.gz |
- Optimize wakeup() and its friends; if a thread waken up is being
swapped in, we do not have to ask for the scheduler thread to do
that.
- Assert that a process is not swapped out in runq functions and
swapout().
- Introduce thread_safetoswapout() for readability.
- In swapout_procs(), perform a test that may block (check of a
thread working on its vm map) first. This lets us call swapout()
with the sched_lock held, providing a better atomicity.
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r-- | sys/kern/kern_synch.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index e4bef85..9e60459 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -719,8 +719,10 @@ restart: maybe_resched(td); } else { td->td_state = TDS_SWAPPED; - p->p_sflag |= PS_SWAPINREQ; - wakeup(&proc0); + if ((p->p_sflag & PS_SWAPPINGIN) == 0) { + p->p_sflag |= PS_SWAPINREQ; + wakeup(&proc0); + } } /* END INLINE EXPANSION */ } @@ -766,8 +768,10 @@ restart: break; } else { td->td_state = TDS_SWAPPED; - p->p_sflag |= PS_SWAPINREQ; - wakeup(&proc0); + if ((p->p_sflag & PS_SWAPPINGIN) == 0) { + p->p_sflag |= PS_SWAPINREQ; + wakeup(&proc0); + } } /* END INLINE EXPANSION */ goto restart; @@ -941,8 +945,10 @@ setrunnable(struct thread *td) td->td_ksegrp->kg_slptime = 0; if ((p->p_sflag & PS_INMEM) == 0) { td->td_state = TDS_SWAPPED; - p->p_sflag |= PS_SWAPINREQ; - wakeup(&proc0); + if ((p->p_sflag & PS_SWAPPINGIN) == 0) { + p->p_sflag |= PS_SWAPINREQ; + wakeup(&proc0); + } } else { if (td->td_state != TDS_RUNQ) setrunqueue(td); /* XXXKSE */ |