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

Function sched_shouldpreempt

freebsd/kern/sched_ule.c:421–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421static inline int
422sched_shouldpreempt(int pri, int cpri, int remote)
423{
424 /*
425 * If the new priority is not better than the current priority there is
426 * nothing to do.
427 */
428 if (pri >= cpri)
429 return (0);
430 /*
431 * Always preempt idle.
432 */
433 if (cpri >= PRI_MIN_IDLE)
434 return (1);
435 /*
436 * If preemption is disabled don't preempt others.
437 */
438 if (preempt_thresh == 0)
439 return (0);
440 /*
441 * Preempt if we exceed the threshold.
442 */
443 if (pri <= preempt_thresh)
444 return (1);
445 /*
446 * If we're interactive or better and there is non-interactive
447 * or worse running preempt only remote processors.
448 */
449 if (remote && pri <= PRI_MAX_INTERACT && cpri > PRI_MAX_INTERACT)
450 return (1);
451 return (0);
452}
453
454/*
455 * Add a thread to the actual run-queue. Keeps transferable counts up to

Callers 2

tdq_notifyFunction · 0.85
sched_setpreemptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected