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

Function critical_exit_preempt

freebsd/kern/kern_switch.c:214–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214void __noinline
215critical_exit_preempt(void)
216{
217 struct thread *td;
218 int flags;
219
220 /*
221 * If td_critnest is 0, it is possible that we are going to get
222 * preempted again before reaching the code below. This happens
223 * rarely and is harmless. However, this means td_owepreempt may
224 * now be unset.
225 */
226 td = curthread;
227 if (td->td_critnest != 0)
228 return;
229 if (kdb_active)
230 return;
231
232 /*
233 * Microoptimization: we committed to switch,
234 * disable preemption in interrupt handlers
235 * while spinning for the thread lock.
236 */
237 td->td_critnest = 1;
238 thread_lock(td);
239 td->td_critnest--;
240 flags = SW_INVOL | SW_PREEMPT;
241 if (TD_IS_IDLETHREAD(td))
242 flags |= SWT_IDLE;
243 else
244 flags |= SWT_OWEPREEMPT;
245 mi_switch(flags);
246}
247
248void
249critical_exit_KBI(void)

Callers 1

critical_exitFunction · 0.85

Calls 1

mi_switchFunction · 0.70

Tested by

no test coverage detected