diff options
author | jeff <jeff@FreeBSD.org> | 2007-09-17 05:31:39 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2007-09-17 05:31:39 +0000 |
commit | 3fc0f8b973fdc2f392a3234d653e09d71e2aab98 (patch) | |
tree | e572a7b77f24339d2dc6ebf6b83c1e2c1ce0f6a5 /sys/kern/kern_clock.c | |
parent | 74666fdfce0e06484d5f82e8fced0c16c06477d1 (diff) | |
download | FreeBSD-src-3fc0f8b973fdc2f392a3234d653e09d71e2aab98.zip FreeBSD-src-3fc0f8b973fdc2f392a3234d653e09d71e2aab98.tar.gz |
- 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)
Diffstat (limited to 'sys/kern/kern_clock.c')
-rw-r--r-- | sys/kern/kern_clock.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index d9a82d2..210f5d3 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -201,34 +201,29 @@ hardclock_cpu(int usermode) struct pstats *pstats; struct thread *td = curthread; struct proc *p = td->td_proc; - int ast; + int flags; /* * Run current process's virtual and profile time, as needed. */ pstats = p->p_stats; - ast = 0; + flags = 0; if (usermode && timevalisset(&pstats->p_timer[ITIMER_VIRTUAL].it_value)) { PROC_SLOCK(p); - if (itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0) { - p->p_sflag |= PS_ALRMPEND; - ast = 1; - } + if (itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0) + flags |= TDF_ALRMPEND | TDF_ASTPENDING; PROC_SUNLOCK(p); } if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value)) { PROC_SLOCK(p); - if (itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0) { - p->p_sflag |= PS_PROFPEND; - ast = 1; - } + if (itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0) + flags |= TDF_PROFPEND | TDF_ASTPENDING; PROC_SUNLOCK(p); } thread_lock(td); sched_tick(); - if (ast) - td->td_flags |= TDF_ASTPENDING; + td->td_flags |= flags; thread_unlock(td); #ifdef HWPMC_HOOKS |