mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-19 15:33:56 +00: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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113636
@ -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 New Issue
Block a user