git: 79a1410c0dcb - stable/13 - sched: sched_switch(): Factorize sleepqueue flags
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 27 Feb 2024 10:42:21 UTC
The branch stable/13 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=79a1410c0dcbdd5245b2b0af17897932d146daa9 commit 79a1410c0dcbdd5245b2b0af17897932d146daa9 Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2024-01-16 09:42:11 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2024-02-27 10:41:36 +0000 sched: sched_switch(): Factorize sleepqueue flags Avoid duplicating common flags for the preempted and non-preempted cases, making it clear that they are the same without resorting to formatting. No functional change. Approved by: markj (mentor) MFC after: 3 days Sponsored by: The FreeBSD Foundation (cherry picked from commit 6a3c02bc52892eb09c3b766562b8ddb452c393a9) Approved by: emaste (mentor) --- sys/kern/sched_4bsd.c | 5 ++--- sys/kern/sched_ule.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 621ec77523bf..700f0dca93aa 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -1016,9 +1016,8 @@ sched_switch(struct thread *td, int flags) } else { if (TD_IS_RUNNING(td)) { /* Put us back on the run queue. */ - sched_add(td, preempted ? - SRQ_HOLDTD|SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED : - SRQ_HOLDTD|SRQ_OURSELF|SRQ_YIELDING); + sched_add(td, SRQ_HOLDTD | SRQ_OURSELF | SRQ_YIELDING | + (preempted ? SRQ_PREEMPTED : 0)); } } diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index e87294d670c0..9220b4700af7 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -2215,9 +2215,8 @@ sched_switch(struct thread *td, int flags) TD_SET_CAN_RUN(td); } else if (TD_IS_RUNNING(td)) { MPASS(mtx == TDQ_LOCKPTR(tdq)); - srqflag = preempted ? - SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED : - SRQ_OURSELF|SRQ_YIELDING; + srqflag = SRQ_OURSELF | SRQ_YIELDING | + (preempted ? SRQ_PREEMPTED : 0); #ifdef SMP if (THREAD_CAN_MIGRATE(td) && (!THREAD_CAN_SCHED(td, ts->ts_cpu) || pickcpu))