The sched_add() function is not only used when the thread is initially
started, but also by the turnstiles to mark a thread as runnable for all locks, for instance sleepqueues do: setrunnable()->sched_wakeup()->sched_add() In r326218 code was added to allow booting from non-zero CPU numbers by setting the ts_cpu field inside the ULE scheduler's sched_add() function. This had an undesired side-effect that prior sched_pin() and sched_bind() calls got disregarded. This patch fixes the initialization of the ts_cpu field for the ULE scheduler to only happen once when the initial thread is constructed during system init. Forking will then later on ensure that a valid ts_cpu value gets copied to all children. Reviewed by: jhb, kib Discussed with: nwhitehorn MFC after: 1 month Differential revision: https://reviews.freebsd.org/D13298 Sponsored by: Mellanox Technologies
This commit is contained in:
parent
97a4e58919
commit
1408b84a26
@ -1405,7 +1405,6 @@ sched_setup(void *dummy)
|
||||
|
||||
/* Add thread0's load since it's running. */
|
||||
TDQ_LOCK(tdq);
|
||||
td_get_sched(&thread0)->ts_cpu = curcpu; /* Something valid to start */
|
||||
thread0.td_lock = TDQ_LOCKPTR(TDQ_SELF());
|
||||
tdq_load_add(tdq, &thread0);
|
||||
tdq->tdq_lowpri = thread0.td_priority;
|
||||
@ -1642,6 +1641,7 @@ schedinit(void)
|
||||
ts0->ts_ltick = ticks;
|
||||
ts0->ts_ftick = ticks;
|
||||
ts0->ts_slice = 0;
|
||||
ts0->ts_cpu = curcpu; /* set valid CPU number */
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2453,7 +2453,6 @@ sched_add(struct thread *td, int flags)
|
||||
* Pick the destination cpu and if it isn't ours transfer to the
|
||||
* target cpu.
|
||||
*/
|
||||
td_get_sched(td)->ts_cpu = curcpu; /* Pick something valid to start */
|
||||
cpu = sched_pickcpu(td, flags);
|
||||
tdq = sched_setcpu(td, cpu, flags);
|
||||
tdq_add(tdq, td, flags);
|
||||
|
Loading…
Reference in New Issue
Block a user