diff options
author | 2019-07-08 18:53:18 +0000 | |
---|---|---|
committer | 2019-07-08 18:53:18 +0000 | |
commit | 55eab86cd4f592594f21d159b23c2a58acefe836 (patch) | |
tree | 34fb972eeddbd3301dcb62990a82450c0dba43c5 /sys/kern/kern_resource.c | |
parent | Get rid of an old convention of wrapping preprocessor constants in curly (diff) | |
download | wireguard-openbsd-55eab86cd4f592594f21d159b23c2a58acefe836.tar.xz wireguard-openbsd-55eab86cd4f592594f21d159b23c2a58acefe836.zip |
Untangle code setting the scheduling priority of a thread.
- `p_estcpu' and `p_usrpri' represent the priority and are now only set
in a single function.
- Call resched_proc() after updating the priority and stop calling it
from schedclock() since `spc_curpriority' should match curproc's priority.
- Rename updatepri() to match decay_cpu() and stop updating per-thread
member.
- Merge two resched_proc() in one inside setrunnable().
Tweak and ok visa@
Diffstat (limited to 'sys/kern/kern_resource.c')
-rw-r--r-- | sys/kern/kern_resource.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 191abef1c35..760f7a73bb8 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_resource.c,v 1.66 2019/06/24 12:49:03 visa Exp $ */ +/* $OpenBSD: kern_resource.c,v 1.67 2019/07/08 18:53:18 mpi Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /*- @@ -212,8 +212,10 @@ donice(struct proc *curp, struct process *chgpr, int n) return (EACCES); chgpr->ps_nice = n; SCHED_LOCK(s); - TAILQ_FOREACH(p, &chgpr->ps_threads, p_thr_link) - (void)resetpriority(p); + TAILQ_FOREACH(p, &chgpr->ps_threads, p_thr_link) { + setpriority(p, p->p_estcpu, n); + resched_proc(p, p->p_usrpri); + } SCHED_UNLOCK(s); return (0); } |