Page MenuHomeFreeBSD

Add a 'SINGLETON' directive to kobj interface definition
ClosedPublic

Authored by jhibbits on Jan 18 2020, 1:20 AM.
Tags
None
Referenced Files
F131800613: D23245.diff
Sat, Oct 11, 6:45 AM
Unknown Object (File)
Thu, Oct 9, 2:17 AM
Unknown Object (File)
Fri, Oct 3, 12:18 AM
Unknown Object (File)
Sat, Sep 27, 3:24 PM
Unknown Object (File)
Aug 3 2025, 1:55 AM
Unknown Object (File)
Aug 2 2025, 8:34 AM
Unknown Object (File)
Jul 26 2025, 3:07 PM
Unknown Object (File)
Jul 7 2025, 11:47 AM
Subscribers
None

Details

Summary

This makes the interface described in the definition file act like a
pseudo-IFUNC service, by caching the found method locally.

Applying this to the PowerPC MMU definitions, it yields a significant
(15-20%) performance improvement, seen in both a 'make buildworld' and a
parallel build of LLVM.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 28748
Build 26759: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Jan 18 2020, 1:34 AM

I would perhaps be inclined to just not use kobj for things that are performance sensitive to be honest. You aren't going to have kldload'able pmaps, so the ABI "win" that kobj gives you isn't really relevant. A simple struct with function pointers would probably give you even lower overhead than the singleton approach.

In D23245#509650, @jhb wrote:

I would perhaps be inclined to just not use kobj for things that are performance sensitive to be honest. You aren't going to have kldload'able pmaps, so the ABI "win" that kobj gives you isn't really relevant. A simple struct with function pointers would probably give you even lower overhead than the singleton approach.

I suspect that's another 5-7% as well. I click ok because it was an easy win and made this point to somebody 10 or 15 years ago at BSDcan.