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)
Feb 24 2024, 12:42 AM
Unknown Object (File)
Jan 16 2024, 12:37 AM
Unknown Object (File)
Dec 22 2023, 11:02 PM
Unknown Object (File)
Dec 20 2023, 7:34 PM
Unknown Object (File)
Nov 21 2023, 7:29 AM
Unknown Object (File)
Nov 13 2023, 10:25 AM
Unknown Object (File)
Nov 6 2023, 5:28 PM
Unknown Object (File)
Nov 6 2023, 4:22 PM
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.