mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Tweak locking in the PS_XCPU handler to hold the sched_lock while reading
p_runtime.
This commit is contained in:
parent
b68e08498f
commit
f5d5cb3c7c
1 changed files with 5 additions and 4 deletions
|
|
@ -222,14 +222,15 @@ ast(struct trapframe *framep)
|
|||
if (sflag & PS_XCPU) {
|
||||
PROC_LOCK(p);
|
||||
rlim = &p->p_rlimit[RLIMIT_CPU];
|
||||
if (p->p_runtime.sec >= rlim->rlim_max)
|
||||
mtx_lock_spin(&sched_lock);
|
||||
if (p->p_runtime.sec >= rlim->rlim_max) {
|
||||
mtx_unlock_spin(&sched_lock);
|
||||
killproc(p, "exceeded maximum CPU limit");
|
||||
else {
|
||||
psignal(p, SIGXCPU);
|
||||
mtx_lock_spin(&sched_lock);
|
||||
} else {
|
||||
if (p->p_cpulimit < rlim->rlim_max)
|
||||
p->p_cpulimit += 5;
|
||||
mtx_unlock_spin(&sched_lock);
|
||||
psignal(p, SIGXCPU);
|
||||
}
|
||||
PROC_UNLOCK(p);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue