git: 847ef7cee8aa - stable/15 - sched_ule: tdq_runq_add(): Scope variables, delineate the different steps

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Wed, 04 Nov 2026 13:25:10 UTC
The branch stable/15 has been updated by olce:

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

commit 847ef7cee8aa2259aefdbb17146a444a34d1fe45
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-10-09 09:19:58 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-11-04 13:21:35 +0000

    sched_ule: tdq_runq_add(): Scope variables, delineate the different steps
    
    For better readability.
    
    No functional change (intended).
    
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit d5e9c642307c13b8058609f421b63e2c72bab45f)
---
 sys/kern/sched_ule.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index c145f4879329..25f5b7c6b925 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -509,19 +509,21 @@ normalize_ts_off(int offset)
 static inline void
 tdq_runq_add(struct tdq *tdq, struct thread *td, int flags)
 {
-	struct td_sched *ts;
 	u_char pri, idx;
 
 	TDQ_LOCK_ASSERT(tdq, MA_OWNED);
 	THREAD_LOCK_BLOCKED_ASSERT(td, MA_OWNED);
 
-	pri = td->td_priority;
-	ts = td_get_sched(td);
 	TD_SET_RUNQ(td);
+
 	if (THREAD_CAN_MIGRATE(td)) {
+		struct td_sched *const ts = td_get_sched(td);
+
 		tdq->tdq_transferable++;
 		ts->ts_flags |= TSF_XFERABLE;
 	}
+
+	pri = td->td_priority;
 	if (PRI_MIN_BATCH <= pri && pri <= PRI_MAX_BATCH) {
 		/*
 		 * The queues allocated to the batch range are not used as