summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2005-11-28 19:09:08 +0000
committerjhb <jhb@FreeBSD.org>2005-11-28 19:09:08 +0000
commit76c1ae2002f9457d3af0231496c3e8b00bdfc7ca (patch)
tree76d3003572590b2259ab20848557c4ee044a6a3a /sys/kern
parentc0d115aa84a5adf0b8170276be84778475d8920a (diff)
downloadFreeBSD-src-76c1ae2002f9457d3af0231496c3e8b00bdfc7ca.zip
FreeBSD-src-76c1ae2002f9457d3af0231496c3e8b00bdfc7ca.tar.gz
When checking to see if a process has exceeded its time limit, flag the
process as over the limit when its time is >= to the limit rather than > the limit. Technically, if p->p_rux.rux_runtime.sec == p->p_pcpulimit and p->p_rux.rux_runtime.frac == 0, the process hasn't exceeded the limit yet. However, having the fraction exactly equal to 0 is rather rare, and it is not worth the overhead to handle that edge case. With just the > comparison, the process would have to exceed its limit by almost a second before it was killed. PR: kern/83192 Submitted by: Maciej Zawadzinski mzawadzinski at gmail dot com Reviewed by: bde MFC after: 1 week
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_synch.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 9694763..f4ff2b0 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -320,10 +320,10 @@ mi_switch(int flags, struct thread *newtd)
/*
* Check if the process exceeds its cpu resource allocation. If
- * over max, arrange to kill the process in ast().
+ * it reaches the max, arrange to kill the process in ast().
*/
if (p->p_cpulimit != RLIM_INFINITY &&
- p->p_rux.rux_runtime.sec > p->p_cpulimit) {
+ p->p_rux.rux_runtime.sec >= p->p_cpulimit) {
p->p_sflag |= PS_XCPU;
td->td_flags |= TDF_ASTPENDING;
}
OpenPOWER on IntegriCloud