MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sched_bind

Function sched_bind

freebsd/kern/sched_ule.c:2712–2731  ·  view source on GitHub ↗

* Bind a thread to a target cpu. */

Source from the content-addressed store, hash-verified

2710 * Bind a thread to a target cpu.
2711 */
2712void
2713sched_bind(struct thread *td, int cpu)
2714{
2715 struct td_sched *ts;
2716
2717 THREAD_LOCK_ASSERT(td, MA_OWNED|MA_NOTRECURSED);
2718 KASSERT(td == curthread, ("sched_bind: can only bind curthread"));
2719 ts = td_get_sched(td);
2720 if (ts->ts_flags & TSF_BOUND)
2721 sched_unbind(td);
2722 KASSERT(THREAD_CAN_MIGRATE(td), ("%p must be migratable", td));
2723 ts->ts_flags |= TSF_BOUND;
2724 sched_pin();
2725 if (PCPU_GET(cpuid) == cpu)
2726 return;
2727 ts->ts_cpu = cpu;
2728 /* When we return from mi_switch we'll be on the correct cpu. */
2729 mi_switch(SW_VOL);
2730 thread_lock(td);
2731}
2732
2733/*
2734 * Release a bound thread.

Callers 15

quiesce_cpusFunction · 0.70
epoch_wait_preemptFunction · 0.70
epoch_drain_callbacksFunction · 0.70
cf_set_methodFunction · 0.70
kern_rebootFunction · 0.70
taskqgroup_binderFunction · 0.70
sctp_mcore_threadFunction · 0.50
msgring_processFunction · 0.50
cpu_initclocksFunction · 0.50
native_apic_free_vectorFunction · 0.50
mca_scan_cpusFunction · 0.50

Calls 4

td_get_schedFunction · 0.85
sched_pinFunction · 0.85
sched_unbindFunction · 0.70
mi_switchFunction · 0.70

Tested by

no test coverage detected