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

Function sched_preempt

freebsd/kern/sched_ule.c:2356–2381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2354}
2355
2356void
2357sched_preempt(struct thread *td)
2358{
2359 struct tdq *tdq;
2360 int flags;
2361
2362 SDT_PROBE2(sched, , , surrender, td, td->td_proc);
2363
2364 thread_lock(td);
2365 tdq = TDQ_SELF();
2366 TDQ_LOCK_ASSERT(tdq, MA_OWNED);
2367 if (td->td_priority > tdq->tdq_lowpri) {
2368 if (td->td_critnest == 1) {
2369 flags = SW_INVOL | SW_PREEMPT;
2370 flags |= TD_IS_IDLETHREAD(td) ? SWT_REMOTEWAKEIDLE :
2371 SWT_REMOTEPREEMPT;
2372 mi_switch(flags);
2373 /* Switch dropped thread lock. */
2374 return;
2375 }
2376 td->td_owepreempt = 1;
2377 } else {
2378 tdq->tdq_owepreempt = 0;
2379 }
2380 thread_unlock(td);
2381}
2382
2383/*
2384 * Fix priorities on return to user-space. Priorities may be elevated due

Callers 4

mips_ipi_handlerFunction · 0.50
ipi_preemptFunction · 0.50
ipi_preemptFunction · 0.50
ipi_bitmap_handlerFunction · 0.50

Calls 1

mi_switchFunction · 0.70

Tested by

no test coverage detected