Page MenuHomeFreeBSD

Introduce nhop_ref_locked_object().
ClosedPublic

Authored by markj on Jul 1 2020, 3:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 21, 2:29 PM
Unknown Object (File)
Dec 20 2023, 5:30 AM
Unknown Object (File)
Nov 18 2023, 6:21 PM
Unknown Object (File)
Nov 18 2023, 1:04 PM
Unknown Object (File)
Nov 18 2023, 12:31 PM
Unknown Object (File)
Nov 18 2023, 12:31 PM
Unknown Object (File)
Nov 18 2023, 11:19 AM
Unknown Object (File)
Oct 26 2023, 1:33 PM
Subscribers

Details

Summary

Use it when we know that the object must have a positive reference
count. This provides two benefits:

  • We can assert that the refcount is positive.
  • We can use a cheaper operation to acquire the reference count.

I am open to alternate name suggestions.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 32093
Build 29612: arc lint + arc unit

Event Timeline

markj requested review of this revision.Jul 1 2020, 3:29 PM

Thank you for raising this diff! Was going to do the same, but you managed to do it faster :-)
LGTM, please see the naming comment :-)

sys/net/route/nhop_ctl.c
609

Naming is hard :-)
Maybe we can do it slightly differently, like leave this function as nhop_ref_object and the original one as nhop_try_ref_object ?

I'd prefer not to mention locked in the name, as nhop objects have their locks, but we don't use them in refcounting.

What do you think?

sys/net/route/nhop_ctl.c
609

I think that's much better than my name, will fix.

Introduce nhop_try_ref_object() instead.

I note that we also have nhop_ref_any() and nhop_free_any() as well,
but they are unused.

Introduce nhop_try_ref_object() instead.

I note that we also have nhop_ref_any() and nhop_free_any() as well,
but they are unused.

That's the route multipath part, which will be introduced soon.

This revision is now accepted and ready to land.Jul 6 2020, 8:48 PM
This revision was automatically updated to reflect the committed changes.