diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-05-22 09:20:23 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2024-05-22 09:20:23 +0000 |
commit | efdfbd463f94001839adbe4f3304d7f77a0abf22 (patch) | |
tree | 345cddc34c44743c07c4a5a8b6802e1b6e393061 /sys | |
parent | 71b073c0cb221c6840af53a6fb9c04ffc5cb2c82 (diff) |
Just grab the SCHED_LOCK() once in donice() before walking the ps_threads
list. setpriority() is trivial and probably faster than releasing and
relocking SCHED_LOCK().
OK jca@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_resource.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 04247e33094..6bc28d5aabc 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_resource.c,v 1.82 2024/05/20 10:32:20 claudio Exp $ */ +/* $OpenBSD: kern_resource.c,v 1.83 2024/05/22 09:20:22 claudio Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /*- @@ -213,11 +213,11 @@ donice(struct proc *curp, struct process *chgpr, int n) return (EACCES); chgpr->ps_nice = n; mtx_enter(&chgpr->ps_mtx); + SCHED_LOCK(s); TAILQ_FOREACH(p, &chgpr->ps_threads, p_thr_link) { - SCHED_LOCK(s); setpriority(p, p->p_estcpu, n); - SCHED_UNLOCK(s); } + SCHED_UNLOCK(s); mtx_leave(&chgpr->ps_mtx); return (0); } |