Page MenuHomeFreeBSD

pf: bound DIOCGETSTATESV2 memory use
ClosedPublic

Authored by kp on Jul 8 2021, 4:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 19 2024, 4:05 PM
Unknown Object (File)
Oct 5 2024, 9:18 PM
Unknown Object (File)
Sep 8 2024, 6:15 AM
Unknown Object (File)
Sep 5 2024, 12:18 PM
Unknown Object (File)
Sep 5 2024, 12:18 PM
Unknown Object (File)
Sep 5 2024, 12:18 PM
Unknown Object (File)
Sep 5 2024, 12:07 PM
Unknown Object (File)
Sep 4 2024, 4:57 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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.