Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jun 2022 19:36:46 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 70f54bc4f3d4 - stable/13 - reap_kill(): de-inline LIST_FOREACH(), twice
Message-ID:  <202206241936.25OJakbT083981@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=70f54bc4f3d4a8796851c6f1f6cc7e86003905ac

commit 70f54bc4f3d4a8796851c6f1f6cc7e86003905ac
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-04-25 21:57:13 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-06-24 14:45:44 +0000

    reap_kill(): de-inline LIST_FOREACH(), twice
    
    (cherry picked from commit e4ce431e2a0255751fee0ad14b08bd006759ce4f)
---
 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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206241936.25OJakbT083981>