Fix the !SMP case in sched_add() after r355779.
If the thread's lock is already that of the runqueue, don't recurse on the queue lock. Reviewed by: jeff, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23492
This commit is contained in:
parent
8151b6e92a
commit
e489450589
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357473
@ -2605,15 +2605,17 @@ sched_add(struct thread *td, int flags)
|
||||
sched_setpreempt(td);
|
||||
#else
|
||||
tdq = TDQ_SELF();
|
||||
TDQ_LOCK(tdq);
|
||||
/*
|
||||
* Now that the thread is moving to the run-queue, set the lock
|
||||
* to the scheduler's lock.
|
||||
*/
|
||||
if ((flags & SRQ_HOLD) != 0)
|
||||
td->td_lock = TDQ_LOCKPTR(tdq);
|
||||
else
|
||||
thread_lock_set(td, TDQ_LOCKPTR(tdq));
|
||||
if (td->td_lock != TDQ_LOCKPTR(tdq)) {
|
||||
TDQ_LOCK(tdq);
|
||||
if ((flags & SRQ_HOLD) != 0)
|
||||
td->td_lock = TDQ_LOCKPTR(tdq);
|
||||
else
|
||||
thread_lock_set(td, TDQ_LOCKPTR(tdq));
|
||||
}
|
||||
tdq_add(tdq, td, flags);
|
||||
if (!(flags & SRQ_YIELDING))
|
||||
sched_setpreempt(td);
|
||||
|
Loading…
Reference in New Issue
Block a user