Page MenuHomeFreeBSD

decouple maximum clock frequency from callout scheduling granularity
AbandonedPublic

Authored by kmacy on Nov 27 2015, 12:28 AM.
Referenced Files
Unknown Object (File)
Wed, Nov 20, 9:01 AM
Unknown Object (File)
Wed, Nov 6, 3:11 PM
Unknown Object (File)
Tue, Nov 5, 11:58 AM
Unknown Object (File)
Mon, Oct 28, 6:14 AM
Unknown Object (File)
Oct 18 2024, 2:38 PM
Unknown Object (File)
Oct 18 2024, 1:29 AM
Unknown Object (File)
Oct 18 2024, 1:29 AM
Unknown Object (File)
Oct 18 2024, 1:05 AM
Subscribers

Details

Reviewers
davide
Summary

Motivated by the need to schedule retransmits at a granularity less than 1ms while not swamping the CPU with excess timer interrupts.

  • change ticks to long
  • add a separate hardclock frequency: kern.hardclock_hz
  • make callout precision behave sensibly, where value passed is 0 or less than SBT_1US it gets replaced with sbt corresponding to hardclock_hz (SBT_1MS by default)
  • add tvtohz64
  • replace calls likely to wrap at higher frequency with tvtohz64

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kmacy retitled this revision from to decouple maximum clock frequency from callout scheduling granularity.
kmacy updated this object.
kmacy edited the test plan for this revision. (Show Details)
kmacy added a reviewer: davide.
kmacy set the repository for this revision to rS FreeBSD src repository - subversion.

The changes look good. I'd split them in multiple patches/commit, more or less following the structure you outlined in the summary, but thanks for sending out a single one so we can have the whole picture.
IIRC there were objections to change ticks from 32-bits to 64-bits so you may want to ask feedback from a more general audience.
Other than that, I'm fine with (a splitted version of this) getting in.

sys/kern/kern_clock.c
472

Atomic on 64-bit integers are slightly more expensive than the 32-bit counterparts. I think it's fine, but do we have numbers on what's the impact of this? (maybe profiling).

sys/kern/kern_tc.c
1285

I may miss something here, but do you ever use the value of the counter you just read?

sys/kern/kern_timeout.c
597

Please add a comment specifying why you round-up, for clarity.

957

Can this be KASSERT() maybe with a message attached "precision needs to be at least 1US"? I'm not fussed about it, so if you don't like it you can leave it as is.

sys/kern/subr_param.c
88

I think you ate a whitespace two lines below.

116

Nit: SYSCTL descriptions always start with capital letters, can you change that?

sys/sys/callout.h
61

Nit again, this seems unaligned.