Page MenuHomeFreeBSD

SMR protection for inpcbs
Needs ReviewPublic

Authored by glebius on Tue, Nov 16, 9:24 PM.

Details

Summary

With introduction of epoch(9) synchronization to network stack the
inpcb database became protected by the network epoch together with
static network data (interfaces, addresses, etc). However, inpcb
aren't static in nature, they are created and destroyed all the
time, which creates some traffic on the epoch(9) garbage collector.

With SMR freed memory is reclaimed in page-sized batches, with
virtually zero overhead. Details:

  • The database is already build on CK lists, thanks to epoch(9).
  • For write access nothing changes, yet.
  • For a lookup in the database SMR section is now required. Once the desired inpcb is found we need to transition from SMR section to r/w lock on the inpcb itself, with a check that inpcb isn't yet freed. This requires some compexity, since SMR section itself is a critical(9) section. The complexity is hidden from KPI users in inp_smr_lock().
  • For a inpcb list traversal (a pcblist sysctl, or broadcast notification) also a new KPI is provided, that hides internals of the database - inp_next(struct inp_iterator *).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 42880
Build 39768: arc lint + arc unit

Event Timeline

Given we don't seem to have a `man smr` could you at least expand SMR once in your title/description so people can find what they are looking for as it's virtually invisible to the world still (unless one finds the header file)?

Note: due to my poor phab skills the previous version was abandoned. Tried to add it to the stack of reviews, but failed. Previous version: https://reviews.freebsd.org/D32585

In D33022#745736, @bz wrote:

Given we don't seem to have a `man smr` could you at least expand SMR once in your title/description so people can find what they are looking for as it's virtually invisible to the world still (unless one finds the header file)?

Yes, absence of the manual page bugs me. Not even mention in uma(9). I will reword description.

inpcb garbage collector traffic in epoch context as seen under uperf -m connect.xml test.

In D33022#745736, @bz wrote:

Given we don't seem to have a `man smr` could you at least expand SMR once in your title/description so people can find what they are looking for as it's virtually invisible to the world still (unless one finds the header file)?

Yes, absence of the manual page bugs me. Not even mention in uma(9). I will reword description.

I agree with all this we are sadly lacking a SMR manual page we really need one if this is going to start
being propagated and used in the kernel!!

This revision is now accepted and ready to land.Wed, Nov 17, 7:40 PM
This revision now requires review to proceed.Fri, Nov 19, 4:39 AM