Download raw body.
kern_resorce: move to lazy updates after donice
> WRITE_ONCE only ensures that the write is made once. It does not really
> help the readers. This part of the diff I would drop for now.
> If we want to go this way then all accesses to ps_nice need to happen
> using the same style.
Updated diff to not include this (or the associated atomic.h include).
Tim
--
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -196,7 +196,6 @@ int
donice(struct proc *curp, struct process *chgpr, int n)
{
struct ucred *ucred = curp->p_ucred;
- struct proc *p;
if (ucred->cr_uid != 0 && ucred->cr_ruid != 0 &&
ucred->cr_uid != chgpr->ps_ucred->cr_uid &&
@@ -210,13 +209,6 @@ donice(struct proc *curp, struct process *chgpr, int n)
if (n < chgpr->ps_nice && suser(curp))
return (EACCES);
chgpr->ps_nice = n;
- mtx_enter(&chgpr->ps_mtx);
- SCHED_LOCK();
- TAILQ_FOREACH(p, &chgpr->ps_threads, p_thr_link) {
- setpriority(p, p->p_estcpu, n);
- }
- SCHED_UNLOCK();
- mtx_leave(&chgpr->ps_mtx);
return (0);
}
kern_resorce: move to lazy updates after donice