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
This commit is contained in:
parent
c0d115aa84
commit
76c1ae2002
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user