mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
- Fix an error that occurs when mp_ncpu is an odd number. steal_thresh
is calculated as 0 which causes errors elsewhere. Submitted by: KOIE Hidetaka <koie@suri.co.jp> - When sched_affinity() is called with a thread that is not curthread we need to handle the ON_RUNQ() case by adding the thread to the correct run queue. Submitted by: Justin Teller <justin.teller@gmail.com> MFC after: 1 Week
This commit is contained in:
parent
3b2dc2ac52
commit
53a6c8b3ac
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=189787
@ -1337,11 +1337,11 @@ sched_initticks(void *dummy)
|
||||
*/
|
||||
balance_interval = realstathz;
|
||||
/*
|
||||
* Set steal thresh to log2(mp_ncpu) but no greater than 4. This
|
||||
* prevents excess thrashing on large machines and excess idle on
|
||||
* smaller machines.
|
||||
* Set steal thresh to roughly log2(mp_ncpu) but no greater than 4.
|
||||
* This prevents excess thrashing on large machines and excess idle
|
||||
* on smaller machines.
|
||||
*/
|
||||
steal_thresh = min(ffs(mp_ncpus) - 1, 3);
|
||||
steal_thresh = min(fls(mp_ncpus) - 1, 3);
|
||||
affinity = SCHED_AFFINITY_DEFAULT;
|
||||
#endif
|
||||
}
|
||||
@ -2417,6 +2417,11 @@ sched_affinity(struct thread *td)
|
||||
ts = td->td_sched;
|
||||
if (THREAD_CAN_SCHED(td, ts->ts_cpu))
|
||||
return;
|
||||
if (TD_ON_RUNQ(td)) {
|
||||
sched_rem(td);
|
||||
sched_add(td, SRQ_BORING);
|
||||
return;
|
||||
}
|
||||
if (!TD_IS_RUNNING(td))
|
||||
return;
|
||||
td->td_flags |= TDF_NEEDRESCHED;
|
||||
|
Loading…
Reference in New Issue
Block a user