mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-01 00:18:15 +01:00
Split out an invariant in order to better check that newtd, when
provided, must be on a runqueue. Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com> MFC: 2 weeks X-MFC: r202889
This commit is contained in:
parent
e7f82fbbaf
commit
58060789e6
@ -943,8 +943,10 @@ sched_switch(struct thread *td, struct thread *newtd, int flags)
|
||||
if ((td->td_flags & TDF_NOLOAD) == 0)
|
||||
sched_load_rem();
|
||||
|
||||
if (newtd)
|
||||
if (newtd) {
|
||||
MPASS(newtd->td_lock == &sched_lock);
|
||||
newtd->td_flags |= (td->td_flags & TDF_NEEDRESCHED);
|
||||
}
|
||||
|
||||
td->td_lastcpu = td->td_oncpu;
|
||||
td->td_flags &= ~TDF_NEEDRESCHED;
|
||||
@ -987,8 +989,8 @@ sched_switch(struct thread *td, struct thread *newtd, int flags)
|
||||
sched_load_add();
|
||||
} else {
|
||||
newtd = choosethread();
|
||||
MPASS(newtd->td_lock == &sched_lock);
|
||||
}
|
||||
MPASS(newtd->td_lock == &sched_lock);
|
||||
|
||||
if (td != newtd) {
|
||||
#ifdef HWPMC_HOOKS
|
||||
|
Loading…
Reference in New Issue
Block a user