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

Function callout_cpu_switch

freebsd/kern/kern_timeout.c:342–363  ·  view source on GitHub ↗

* Switches the cpu tied to a specific callout. * The function expects a locked incoming callout cpu and returns with * locked outcoming callout cpu. */

Source from the content-addressed store, hash-verified

340 * locked outcoming callout cpu.
341 */
342static struct callout_cpu *
343callout_cpu_switch(struct callout *c, struct callout_cpu *cc, int new_cpu)
344{
345 struct callout_cpu *new_cc;
346
347 MPASS(c != NULL && cc != NULL);
348 CC_LOCK_ASSERT(cc);
349
350 /*
351 * Avoid interrupts and preemption firing after the callout cpu
352 * is blocked in order to avoid deadlocks as the new thread
353 * may be willing to acquire the callout cpu lock.
354 */
355 c->c_cpu = CPUBLOCK;
356 spinlock_enter();
357 CC_UNLOCK(cc);
358 new_cc = CC_CPU(new_cpu);
359 CC_LOCK(new_cc);
360 spinlock_exit();
361 c->c_cpu = new_cpu;
362 return (new_cc);
363}
364#endif
365
366/*

Callers 2

softclock_call_ccFunction · 0.85
callout_reset_sbt_onFunction · 0.85

Calls 2

spinlock_enterFunction · 0.50
spinlock_exitFunction · 0.50

Tested by

no test coverage detected