git: b9893b353312 - main - weed_inhib(): do not double-suspend already suspended thread if the loop reiterates

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 13 Jun 2022 19:33:31 UTC
The branch main has been updated by kib:

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

commit b9893b353312cc3c75a0ab2ff7ca69dc55864bea
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-04-30 23:30:13 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-06-13 19:30:02 +0000

    weed_inhib(): do not double-suspend already suspended thread if the loop reiterates
    
    In collaboration with:  pho
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      2 weeks
    Differential revision:  https://reviews.freebsd.org/D35310
---
 sys/kern/kern_thread.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 4dd8dbdfb5a7..1247d842beb1 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -1156,7 +1156,8 @@ restart:
 		}
 		if (TD_CAN_ABORT(td2)) {
 			if ((td2->td_flags & TDF_SBDRY) == 0) {
-				thread_suspend_one(td2);
+				if (!TD_IS_SUSPENDED(td2))
+					thread_suspend_one(td2);
 				td2->td_flags |= TDF_ALLPROCSUSP;
 			} else {
 				wakeup_swapper |= sleepq_abort(td2, ERESTART);