summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_synch.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-09-30 21:13:54 +0000
committerjhb <jhb@FreeBSD.org>2002-09-30 21:13:54 +0000
commitf350519764aa2a5ac7d6daaee05afd36a81279c5 (patch)
tree7decfe1c15133add5e1c3fa81470e85d400fc06a /sys/kern/kern_synch.c
parentf72526c16f332fb7d82318bc526cdafaa25f5b62 (diff)
downloadFreeBSD-src-f350519764aa2a5ac7d6daaee05afd36a81279c5.zip
FreeBSD-src-f350519764aa2a5ac7d6daaee05afd36a81279c5.tar.gz
- Add a new per-process flag PS_XCPU to indicate that at least one thread
has exceeded its CPU time limit. - In mi_switch(), set PS_XCPU when the CPU time limit is exceeded. - Perform actual CPU time limit exceeded work in ast() when PS_XCPU is set. Requested by: many
Diffstat (limited to 'sys/kern/kern_synch.c')
-rw-r--r--sys/kern/kern_synch.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 445936b..6b37181 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -753,9 +753,6 @@ mi_switch(void)
struct thread *td = curthread; /* XXX */
struct proc *p = td->td_proc; /* XXX */
struct kse *ke = td->td_kse;
-#if 0
- register struct rlimit *rlim;
-#endif
u_int sched_nest;
mtx_assert(&sched_lock, MA_OWNED | MA_NOTRECURSED);
@@ -788,36 +785,13 @@ mi_switch(void)
}
#endif
-#if 0
/*
* Check if the process exceeds its cpu resource allocation.
- * If over max, kill it.
- *
- * XXX drop sched_lock, pickup Giant
*/
if (p->p_state != PRS_ZOMBIE &&
p->p_limit->p_cpulimit != RLIM_INFINITY &&
- p->p_runtime > p->p_limit->p_cpulimit) {
- rlim = &p->p_rlimit[RLIMIT_CPU];
- if (p->p_runtime / (rlim_t)1000000 >= rlim->rlim_max) {
- mtx_unlock_spin(&sched_lock);
- PROC_LOCK(p);
- killproc(p, "exceeded maximum CPU limit");
- mtx_lock_spin(&sched_lock);
- PROC_UNLOCK(p);
- } else {
- mtx_unlock_spin(&sched_lock);
- PROC_LOCK(p);
- psignal(p, SIGXCPU);
- mtx_lock_spin(&sched_lock);
- PROC_UNLOCK(p);
- if (rlim->rlim_cur < rlim->rlim_max) {
- /* XXX: we should make a private copy */
- rlim->rlim_cur += 5;
- }
- }
- }
-#endif
+ p->p_runtime.sec > p->p_limit->p_cpulimit)
+ p->p_sflag |= PS_XCPU;
/*
* Finish up stats for outgoing thread.
OpenPOWER on IntegriCloud