* Return whether the current CPU has runnable tasks. Used for in-kernel * cooperative idle threads. */
| 2472 | * cooperative idle threads. |
| 2473 | */ |
| 2474 | int |
| 2475 | sched_runnable(void) |
| 2476 | { |
| 2477 | struct tdq *tdq; |
| 2478 | int load; |
| 2479 | |
| 2480 | load = 1; |
| 2481 | |
| 2482 | tdq = TDQ_SELF(); |
| 2483 | if ((curthread->td_flags & TDF_IDLETD) != 0) { |
| 2484 | if (tdq->tdq_load > 0) |
| 2485 | goto out; |
| 2486 | } else |
| 2487 | if (tdq->tdq_load - 1 > 0) |
| 2488 | goto out; |
| 2489 | load = 0; |
| 2490 | out: |
| 2491 | return (load); |
| 2492 | } |
| 2493 | |
| 2494 | /* |
| 2495 | * Choose the highest priority thread to run. The thread is removed from |
no outgoing calls
no test coverage detected