Page MenuHomeFreeBSD

vm: fix swap reservation leak
ClosedPublic

Authored by mjg on Jul 23 2020, 1:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jun 17, 11:17 PM
Unknown Object (File)
Tue, Jun 17, 10:36 PM
Unknown Object (File)
Tue, Jun 17, 8:00 PM
Unknown Object (File)
Sat, Jun 14, 9:57 PM
Unknown Object (File)
Wed, Jun 11, 10:22 PM
Unknown Object (File)
Jun 5 2025, 7:12 AM
Unknown Object (File)
May 19 2025, 4:06 AM
Unknown Object (File)
May 13 2025, 7:23 AM
Subscribers

Details

Summary

If per-uid limit is exceeded, the cleanup fails to subtract from the global counter.

While here cleanup the code.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mjg requested review of this revision.Jul 23 2020, 1:35 PM

Since you are doing cleanups, perhaps change the return type to bool, there and for swap_reserve().

sys/vm/swap_pager.c
247 ↗(On Diff #74840)

Please invert all conditions and s/||/&&/

  • way more refactoring

I'm working on a patch to introduce per-cpu counting here so this serves as a good prep.

sys/vm/swap_pager.c
216 ↗(On Diff #74866)

priv_check() != 0

218 ↗(On Diff #74866)

Might be, make this KASSERT

263 ↗(On Diff #74866)

Move oc declaration above statics.

284 ↗(On Diff #74866)

if (r > s && (oc & _ALLOW_NONWIRED) != 0) {

292 ↗(On Diff #74866)

Again, make this KASSERT

299 ↗(On Diff #74866)

And this

This revision is now accepted and ready to land.Jul 24 2020, 12:09 PM