Page MenuHomeFreeBSD

pf: Initialize the table entry zone limit at initialization time
ClosedPublic

Authored by markj on Mar 30 2022, 5:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 1:13 AM
Unknown Object (File)
Oct 3 2024, 4:26 PM
Unknown Object (File)
Sep 10 2024, 8:39 PM
Unknown Object (File)
Sep 5 2024, 2:08 AM
Unknown Object (File)
Sep 2 2024, 11:16 AM
Unknown Object (File)
Aug 31 2024, 3:11 AM
Unknown Object (File)
Aug 18 2024, 11:29 PM
Unknown Object (File)
Aug 17 2024, 7:21 PM

Details

Summary

The limit may later be updated by the "set limit" directive in pf.conf.
UMA does not permit a limit to be set on a zone after any items have
been allocated from a zone.

Other UMA zones used by pf do not appear to be susceptible to this
problem: they either set a limit at zone creation time or never set one
at all.

PR: 260406

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Mar 30 2022, 5:01 PM

That seems sane.

Does uma cope if limits get reduced, or does that also risk underflows?

(Also, it'd be nice to have UMA assert on this sort of mis-use.)

This revision is now accepted and ready to land.Mar 30 2022, 5:59 PM
In D34713#786690, @kp wrote:

That seems sane.

Does uma cope if limits get reduced, or does that also risk underflows?

I don't see a way for underflow to happen in that case. When a limit is set on a zone, UMA starts counting each item allocated to the zone from the slab layer. This counting is independent of the limit itself.

(Also, it'd be nice to have UMA assert on this sort of mis-use.)

Yep, I have a follow-up commit which does exactly that.

I guess one question is whether anyone's relying on the fact that the limit is unset by default. Perhaps the default limit should be INT_MAX instead, at least in stable branches?

I guess one question is whether anyone's relying on the fact that the limit is unset by default. Perhaps the default limit should be INT_MAX instead, at least in stable branches?

Given V_pf_limits[PF_LIMIT_TABLE_ENTRIES].limit = PFR_KENTRY_HIWAT; (i.e. we reported a limit to user space already) I'd think of the old behaviour as a bug and this is just a bug fix.