Page MenuHomeFreeBSD

pf: bound DIOCGETSTATESV2 memory use
ClosedPublic

Authored by kp on Jul 8 2021, 4:27 PM.
Tags
None
Referenced Files
F157117207: D31111.id91979.diff
Mon, May 18, 1:47 PM
Unknown Object (File)
Sun, May 17, 5:53 PM
Unknown Object (File)
Sun, May 17, 5:22 PM
Unknown Object (File)
Sat, May 16, 1:10 AM
Unknown Object (File)
Sat, May 16, 1:10 AM
Unknown Object (File)
Sat, May 16, 1:10 AM
Unknown Object (File)
Fri, May 15, 12:26 PM
Unknown Object (File)
Mon, Apr 27, 3:46 PM

Details

Summary

Rather than allocating however much memory userspace asks for we only
allocate enough for a handful of states, and copy to userspace for each
completed row.
We start out with enough space for 16 states (per row), but grow that as
required. In most configurations we expect at most a handful of states
per row (more than that would have other negative effects on packet
processing performance).

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 40395
Build 37284: arc lint + arc unit

Event Timeline

kp requested review of this revision.Jul 8 2021, 4:27 PM

The previous DIOCGETSTATES call should get the same treatment.

mjg added a subscriber: mjg.

This is a little simplistic as it could load up more and be faster for it, but it is a step forward.

This revision is now accepted and ready to land.Jul 8 2021, 6:46 PM
In D31111#699939, @mjg wrote:

This is a little simplistic as it could load up more and be faster for it, but it is a step forward.

We're at about 3 seconds for a million states with this version, so I'd prefer to keep it as simple as possible.

This revision was automatically updated to reflect the committed changes.