From b21c774f9611a2013048bb9dfc02468e6860dad1 Mon Sep 17 00:00:00 2001 From: mpi Date: Mon, 7 Dec 2020 16:55:28 +0000 Subject: Convert the per-process thread list into a SMR_TAILQ. Currently all iterations are done under KERNEL_LOCK() and therefor use the *_LOCKED() variant. From and ok claudio@ --- sys/kern/kern_resource.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/kern/kern_resource.c') diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 0111bfa733a..543f96ed7e2 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_resource.c,v 1.69 2020/09/25 20:24:32 cheloha Exp $ */ +/* $OpenBSD: kern_resource.c,v 1.70 2020/12/07 16:55:28 mpi Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /*- @@ -212,7 +212,7 @@ 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) { + SMR_TAILQ_FOREACH_LOCKED(p, &chgpr->ps_threads, p_thr_link) { setpriority(p, p->p_estcpu, n); } SCHED_UNLOCK(s); @@ -488,7 +488,7 @@ dogetrusage(struct proc *p, int who, struct rusage *rup) memset(rup, 0, sizeof(*rup)); /* add on all living threads */ - TAILQ_FOREACH(q, &pr->ps_threads, p_thr_link) { + SMR_TAILQ_FOREACH_LOCKED(q, &pr->ps_threads, p_thr_link) { ruadd(rup, &q->p_ru); tuagg(pr, q); } -- cgit v1.2.3-59-g8ed1b