Date: Mon, 19 Feb 2024 16:42:12 GMT From: Olivier Certner <olce@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 6a3c02bc5289 - main - sched: sched_switch(): Factorize sleepqueue flags Message-ID: <202402191642.41JGgCta093156@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=6a3c02bc52892eb09c3b766562b8ddb452c393a9 commit 6a3c02bc52892eb09c3b766562b8ddb452c393a9 Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2024-01-16 09:42:11 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2024-02-19 16:37:19 +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 --- 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 efcd9b7cb250..f0fffeb08e2d 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -1041,9 +1041,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 ebd7139fa612..c0d085fcf906 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -2227,9 +2227,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))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402191642.41JGgCta093156>