git: bd84094a51c4 - main - sched_ule(4): Fix interactive threads stealing.

Alexander Motin mav at FreeBSD.org
Tue Sep 21 20:03:41 UTC 2021


The branch main has been updated by mav:

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

commit bd84094a51c4648a7c97ececdaccfb30bc832096
Author:     Alexander Motin <mav at FreeBSD.org>
AuthorDate: 2021-09-21 19:56:49 +0000
Commit:     Alexander Motin <mav at FreeBSD.org>
CommitDate: 2021-09-21 20:03:32 +0000

    sched_ule(4): Fix interactive threads stealing.
    
    In scenarios when first thread in the queue can migrate to specified
    CPU, but later ones can't runq_steal_from() incorrectly returned NULL.
    
    MFC after:      2 weeks
---
 sys/kern/sched_ule.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 9bcc2a64e2b8..90f294bb0d4d 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -1110,10 +1110,12 @@ again:
 				continue;
 			rqh = &rq->rq_queues[bit + (i << RQB_L2BPW)];
 			TAILQ_FOREACH(td, rqh, td_runq) {
-				if (first && THREAD_CAN_MIGRATE(td) &&
-				    THREAD_CAN_SCHED(td, cpu))
-					return (td);
-				first = td;
+				if (first) {
+					if (THREAD_CAN_MIGRATE(td) &&
+					    THREAD_CAN_SCHED(td, cpu))
+						return (td);
+				} else
+					first = td;
 			}
 		}
 	}


More information about the dev-commits-src-all mailing list