diff options
author | 2020-12-07 16:55:28 +0000 | |
---|---|---|
committer | 2020-12-07 16:55:28 +0000 | |
commit | b21c774f9611a2013048bb9dfc02468e6860dad1 (patch) | |
tree | 0edc08a4801a5acf3d04ac257d6e94fc91e554f5 /sys/kern/tty.c | |
parent | Limit the URL embedded in .cer files to only consist out of isalnum or (diff) | |
download | wireguard-openbsd-b21c774f9611a2013048bb9dfc02468e6860dad1.tar.xz wireguard-openbsd-b21c774f9611a2013048bb9dfc02468e6860dad1.zip |
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@
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r-- | sys/kern/tty.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index efd8bbf5cb9..40ca90eb952 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.164 2020/09/09 16:29:14 mpi Exp $ */ +/* $OpenBSD: tty.c,v 1.165 2020/12/07 16:55:29 mpi Exp $ */ /* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */ /*- @@ -2118,7 +2118,7 @@ process_sum(struct process *pr, fixpt_t *estcpup) ret = 0; estcpu = 0; - TAILQ_FOREACH(p, &pr->ps_threads, p_thr_link) { + SMR_TAILQ_FOREACH_LOCKED(p, &pr->ps_threads, p_thr_link) { if (p->p_stat == SRUN || p->p_stat == SONPROC) ret = 1; estcpu += p->p_pctcpu; @@ -2220,12 +2220,12 @@ update_pickpr: * - prefer living * Otherwise take the newest thread */ - pick = p = TAILQ_FIRST(&pickpr->ps_threads); + pick = p = SMR_TAILQ_FIRST_LOCKED(&pickpr->ps_threads); if (p == NULL) goto empty; run = p->p_stat == SRUN || p->p_stat == SONPROC; pctcpu = p->p_pctcpu; - while ((p = TAILQ_NEXT(p, p_thr_link)) != NULL) { + while ((p = SMR_TAILQ_NEXT_LOCKED(p, p_thr_link)) != NULL) { run2 = p->p_stat == SRUN || p->p_stat == SONPROC; pctcpu2 = p->p_pctcpu; if (run) { |