| 301 | } |
| 302 | |
| 303 | void |
| 304 | callout_tick(void) |
| 305 | { |
| 306 | struct callout_cpu *cc; |
| 307 | int need_softclock; |
| 308 | int bucket; |
| 309 | |
| 310 | /* |
| 311 | * Process callouts at a very low cpu priority, so we don't keep the |
| 312 | * relatively high clock interrupt priority any longer than necessary. |
| 313 | */ |
| 314 | need_softclock = 0; |
| 315 | cc = CC_SELF(); |
| 316 | mtx_lock(&cc->cc_lock); |
| 317 | for (; (cc->cc_softticks - ticks) < 0; cc->cc_softticks++) { |
| 318 | bucket = cc->cc_softticks & callwheelmask; |
| 319 | if (!LIST_EMPTY(&cc->cc_callwheel[bucket])) { |
| 320 | need_softclock = 1; |
| 321 | break; |
| 322 | } |
| 323 | } |
| 324 | mtx_unlock(&cc->cc_lock); |
| 325 | /* |
| 326 | * swi_sched acquires the thread lock, so we don't want to call it |
| 327 | * with cc_lock held; incorrect locking order. |
| 328 | */ |
| 329 | if (need_softclock) |
| 330 | softclock(cc); |
| 331 | } |
| 332 | |
| 333 | static struct callout_cpu * |
| 334 | callout_lock(struct callout *c) |
no test coverage detected