The branch main has been updated by kib:

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

commit dd883e9a7e8045d86774fa3f944b53a4f78d0fd0
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2022-05-10 23:37:58 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2022-06-13 19:30:03 +0000

    weed_inhib(): correct the condition to re-suspend a thread
    
    suspended for SINGLE_ALLPROC mode.  There is no need to check for
    boundary state.  It is only required to see that the suspension comes
    from the ALLPROC mode.
    
    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 | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 1247d842beb1..de04fee8cb96 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -1144,25 +1144,20 @@ restart:
                 * ALLPROC suspend tries to avoid spurious EINTR for
                 * threads sleeping interruptable, by suspending the
                 * thread directly, similarly to sig_suspend_threads().
-                * Since such sleep is not performed at the user
-                * boundary, TDF_BOUNDARY flag is not set, and TDF_ALLPROCSUSP
-                * is used to avoid immediate un-suspend.
+                * Since such sleep is not neccessary performed at the user
+                * boundary, TDF_ALLPROCSUSP is used to avoid immediate
+                * un-suspend.
                 */
-               if (TD_IS_SUSPENDED(td2) && (td2->td_flags & (TDF_BOUNDARY |
-                   TDF_ALLPROCSUSP)) == 0) {
+               if (TD_IS_SUSPENDED(td2) && (td2->td_flags &
+                   TDF_ALLPROCSUSP) == 0) {
                        wakeup_swapper |= thread_unsuspend_one(td2, p, false);
                        thread_lock(td2);
                        goto restart;
                }
                if (TD_CAN_ABORT(td2)) {
-                       if ((td2->td_flags & TDF_SBDRY) == 0) {
-                               if (!TD_IS_SUSPENDED(td2))
-                                       thread_suspend_one(td2);
-                               td2->td_flags |= TDF_ALLPROCSUSP;
-                       } else {
-                               wakeup_swapper |= sleepq_abort(td2, ERESTART);
-                               return (wakeup_swapper);
-                       }
+                       td2->td_flags |= TDF_ALLPROCSUSP;
+                       wakeup_swapper |= sleepq_abort(td2, ERESTART);
+                       return (wakeup_swapper);
                }
                break;
        default:

Reply via email to