git: e4ce431e2a02 - main - reap_kill(): de-inline LIST_FOREACH(), twice
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 27 Apr 2022 23:27:49 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=e4ce431e2a0255751fee0ad14b08bd006759ce4f
commit e4ce431e2a0255751fee0ad14b08bd006759ce4f
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-04-25 21:57:13 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-04-27 23:27:34 +0000
reap_kill(): de-inline LIST_FOREACH(), twice
Suggested and reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D35014
---
sys/kern/kern_procctl.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sys/kern/kern_procctl.c b/sys/kern/kern_procctl.c
index f90c0e146e2b..96748e27f57c 100644
--- a/sys/kern/kern_procctl.c
+++ b/sys/kern/kern_procctl.c
@@ -309,8 +309,7 @@ reap_kill(struct thread *td, struct proc *p, void *data)
rk->rk_killed = 0;
rk->rk_fpid = -1;
if ((rk->rk_flags & REAPER_KILL_CHILDREN) != 0) {
- for (p2 = LIST_FIRST(&reap->p_children); p2 != NULL;
- p2 = LIST_NEXT(p2, p_sibling)) {
+ LIST_FOREACH(p2, &reap->p_children, p_sibling) {
reap_kill_proc(td, p2, &ksi, rk, &error);
/*
* Do not end the loop on error, signal
@@ -323,8 +322,8 @@ reap_kill(struct thread *td, struct proc *p, void *data)
while ((t = TAILQ_FIRST(&tracker)) != NULL) {
MPASS((t->parent->p_treeflag & P_TREE_REAPER) != 0);
TAILQ_REMOVE(&tracker, t, link);
- for (p2 = LIST_FIRST(&t->parent->p_reaplist); p2 != NULL;
- p2 = LIST_NEXT(p2, p_reapsibling)) {
+ LIST_FOREACH(p2, &t->parent->p_reaplist,
+ p_reapsibling) {
if (t->parent == reap &&
(rk->rk_flags & REAPER_KILL_SUBTREE) != 0 &&
p2->p_reapsubtree != rk->rk_subtree)