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)
Wed, Apr 17, 9:22 PM
Unknown Object (File)
Mar 7 2024, 11:31 PM
Unknown Object (File)
Feb 12 2024, 12:53 AM
Unknown Object (File)
Feb 10 2024, 5:26 PM
Unknown Object (File)
Dec 23 2023, 12:30 AM
Unknown Object (File)
Dec 20 2023, 3:00 PM
Unknown Object (File)
Dec 12 2023, 2:54 PM
Unknown Object (File)
Nov 26 2023, 4:42 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.