Page MenuHomeFreeBSD

Convert cryptostats to a counter_u64 array.

Authored by markj on Jun 26 2020, 2:53 PM.



The global counters were not SMP-friendly. Use per-CPU counters

These counters are of dubious usefulness to begin with, but I think
having a framework to easily add new counters is useful, so let's keep
them for now.

Note: we are changing the sysctl ABI, but it has changed once in HEAD
already since 12 was branched. (It was renamed in r359374.)

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

markj requested review of this revision.Jun 26 2020, 2:53 PM
markj created this revision.

I’m not keen on the struct <-> array coercion

236 ↗(On Diff #73694)

Sizeof mismatches the structure type

markj marked an inline comment as done.

Fix the internal counter array size.

In D25466#562261, @cem wrote:

I’m not keen on the struct <-> array coercion

For what it's worth, this is how all of the network stats are handled as well.

Internally we use an array of counter_u64's and the sysctl handler for COUNTER_U64_ARRAY fetches the value for each stat out of the array. So really we are just assuming that struct cryptostats can be treated as an array of uint64_t.

This revision is now accepted and ready to land.Jun 26 2020, 6:31 PM
This revision was automatically updated to reflect the committed changes.