| 563 | } |
| 564 | |
| 565 | static void |
| 566 | callout_cc_add(struct callout *c, struct callout_cpu *cc, |
| 567 | sbintime_t sbt, sbintime_t precision, void (*func)(void *), |
| 568 | void *arg, int cpu, int flags) |
| 569 | { |
| 570 | int bucket; |
| 571 | |
| 572 | CC_LOCK_ASSERT(cc); |
| 573 | if (sbt < cc->cc_lastscan) |
| 574 | sbt = cc->cc_lastscan; |
| 575 | c->c_arg = arg; |
| 576 | c->c_iflags |= CALLOUT_PENDING; |
| 577 | c->c_iflags &= ~CALLOUT_PROCESSED; |
| 578 | c->c_flags |= CALLOUT_ACTIVE; |
| 579 | if (flags & C_DIRECT_EXEC) |
| 580 | c->c_iflags |= CALLOUT_DIRECT; |
| 581 | c->c_func = func; |
| 582 | c->c_time = sbt; |
| 583 | c->c_precision = precision; |
| 584 | bucket = callout_get_bucket(c->c_time); |
| 585 | CTR3(KTR_CALLOUT, "precision set for %p: %d.%08x", |
| 586 | c, (int)(c->c_precision >> 32), |
| 587 | (u_int)(c->c_precision & 0xffffffff)); |
| 588 | LIST_INSERT_HEAD(&cc->cc_callwheel[bucket], c, c_links.le); |
| 589 | if (cc->cc_bucket == bucket) |
| 590 | cc_exec_next(cc) = c; |
| 591 | |
| 592 | /* |
| 593 | * Inform the eventtimers(4) subsystem there's a new callout |
| 594 | * that has been inserted, but only if really required. |
| 595 | */ |
| 596 | if (SBT_MAX - c->c_time < c->c_precision) |
| 597 | c->c_precision = SBT_MAX - c->c_time; |
| 598 | sbt = c->c_time + c->c_precision; |
| 599 | if (sbt < cc->cc_firstevent) { |
| 600 | cc->cc_firstevent = sbt; |
| 601 | cpu_new_callout(cpu, sbt, c->c_time); |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | static void |
| 606 | softclock_call_cc(struct callout *c, struct callout_cpu *cc, |
no test coverage detected