Fix panic that happens when fork(2) fails due to a limit other than
the rctl one - for example, it happens when someone reaches maximum number of processes in the system. Approved by: re (kib)
This commit is contained in:
parent
6fae67da24
commit
2419d7f93b
@ -605,6 +605,7 @@ racct_proc_fork(struct proc *parent, struct proc *child)
|
|||||||
void
|
void
|
||||||
racct_proc_exit(struct proc *p)
|
racct_proc_exit(struct proc *p)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
uint64_t runtime;
|
uint64_t runtime;
|
||||||
|
|
||||||
PROC_LOCK(p);
|
PROC_LOCK(p);
|
||||||
@ -618,14 +619,18 @@ racct_proc_exit(struct proc *p)
|
|||||||
if (runtime < p->p_prev_runtime)
|
if (runtime < p->p_prev_runtime)
|
||||||
runtime = p->p_prev_runtime;
|
runtime = p->p_prev_runtime;
|
||||||
#endif
|
#endif
|
||||||
racct_set(p, RACCT_CPU, runtime);
|
mtx_lock(&racct_lock);
|
||||||
|
racct_set_locked(p, RACCT_CPU, runtime);
|
||||||
|
|
||||||
/*
|
for (i = 0; i <= RACCT_MAX; i++) {
|
||||||
* XXX: Free this some other way.
|
if (p->p_racct->r_resources[i] == 0)
|
||||||
*/
|
continue;
|
||||||
racct_set(p, RACCT_NPTS, 0);
|
if (!RACCT_IS_RECLAIMABLE(i))
|
||||||
racct_set(p, RACCT_NTHR, 0);
|
continue;
|
||||||
racct_set(p, RACCT_RSS, 0);
|
racct_set_locked(p, i, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
mtx_unlock(&racct_lock);
|
||||||
PROC_UNLOCK(p);
|
PROC_UNLOCK(p);
|
||||||
|
|
||||||
#ifdef RCTL
|
#ifdef RCTL
|
||||||
|
Loading…
Reference in New Issue
Block a user