mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
- When migrating a kse from one kseq to the next actually insert it onto
the second kseq's run queue so that it is referenced by the kse when it is switched out. - Spell ksq_rslices properly. Reported by: Ian Freislich <ianf@za.uu.net>
This commit is contained in:
parent
cc59b11e0f
commit
c36ccfa22b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113370
@ -924,7 +924,7 @@ sched_clock(struct kse *ke)
|
||||
*/
|
||||
ke->ke_slice--;
|
||||
#ifdef SMP
|
||||
kseq->ksq_rslice--;
|
||||
kseq->ksq_rslices--;
|
||||
#endif
|
||||
|
||||
if (ke->ke_slice > 0)
|
||||
@ -991,16 +991,11 @@ sched_choose(void)
|
||||
{
|
||||
struct kseq *kseq;
|
||||
struct kse *ke;
|
||||
#ifdef SMP
|
||||
int steal;
|
||||
|
||||
steal = 0;
|
||||
#endif
|
||||
|
||||
kseq = KSEQ_SELF();
|
||||
#ifdef SMP
|
||||
retry:
|
||||
#endif
|
||||
kseq = KSEQ_SELF();
|
||||
ke = kseq_choose(kseq);
|
||||
if (ke) {
|
||||
runq_remove(ke->ke_runq, ke);
|
||||
@ -1011,28 +1006,30 @@ sched_choose(void)
|
||||
ke, ke->ke_runq, ke->ke_slice,
|
||||
ke->ke_thread->td_priority);
|
||||
}
|
||||
#ifdef SMP
|
||||
/*
|
||||
* If we've stolen this thread we need to kill the pointer
|
||||
* to the run queue and reset the cpu id.
|
||||
*/
|
||||
if (steal) {
|
||||
kseq_rem(kseq, ke);
|
||||
ke->ke_cpu = PCPU_GET(cpuid);
|
||||
kseq_add(KSEQ_SELF(), ke);
|
||||
}
|
||||
#endif
|
||||
return (ke);
|
||||
}
|
||||
|
||||
#ifdef SMP
|
||||
if (ke == NULL && smp_started) {
|
||||
if (smp_started) {
|
||||
/*
|
||||
* Find the cpu with the highest load and steal one proc.
|
||||
*/
|
||||
steal = 1;
|
||||
if ((kseq = kseq_load_highest()) != NULL)
|
||||
goto retry;
|
||||
if ((kseq = kseq_load_highest()) == NULL)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Remove this kse from this kseq and runq and then requeue
|
||||
* on the current processor. Then we will dequeue it
|
||||
* normally above.
|
||||
*/
|
||||
ke = kseq_choose(kseq);
|
||||
runq_remove(ke->ke_runq, ke);
|
||||
ke->ke_state = KES_THREAD;
|
||||
kseq_rem(kseq, ke);
|
||||
|
||||
ke->ke_cpu = PCPU_GET(cpuid);
|
||||
sched_add(ke);
|
||||
goto retry;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user