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)
Tue, Jul 15, 9:52 AM
Unknown Object (File)
Sat, Jun 28, 3:06 PM
Unknown Object (File)
Sat, Jun 28, 8:33 AM
Unknown Object (File)
Fri, Jun 27, 5:09 AM
Unknown Object (File)
Wed, Jun 25, 7:14 PM
Unknown Object (File)
Mon, Jun 23, 3:16 AM
Unknown Object (File)
Sat, Jun 21, 1:15 PM
Unknown Object (File)
Jun 10 2025, 1:11 AM
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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #73969)

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 ↗(On Diff #73969)

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.