| 419 | } |
| 420 | |
| 421 | static inline int |
| 422 | sched_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 |
no outgoing calls
no test coverage detected