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
This commit is contained in:
Olivier Certner 2024-01-16 10:42:11 +01:00
parent 849599e28a
commit 6a3c02bc52
No known key found for this signature in database
GPG key ID: 8CA13040971E2627
2 changed files with 4 additions and 6 deletions

View file

@ -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));
}
}

View file

@ -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))