Page MenuHomeFreeBSD

Fix the background laundering mechanism.
ClosedPublic

Authored by markj on Mar 28 2018, 5:00 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 17, 3:52 AM
Unknown Object (File)
Wed, Dec 4, 9:39 AM
Unknown Object (File)
Sun, Nov 24, 10:12 PM
Unknown Object (File)
Oct 31 2024, 4:54 PM
Unknown Object (File)
Sep 25 2024, 2:06 AM
Unknown Object (File)
Sep 24 2024, 11:57 AM
Unknown Object (File)
Sep 24 2024, 2:11 AM
Unknown Object (File)
Sep 23 2024, 1:10 AM
Subscribers

Details

Summary

We used to use the number of inactive queue scans as a measure of how
many clean pages were being reclaimed by the page daemon. This was used
to decide how often to launder a small number of dirty pages. With r329882, we
now scan the inactive queue more frequently, freeing a smaller number of
pages each time. Thus, the number of scans isn't as useful a metric and
we now launder too often.

Rather than counting scans, just count the total number of clean pages
freed during inactive queue scans. The laundry thread adds this value
into an accumulator which gets cleared once the background laundering
threshold is reached. This way we consider only the number of pages
freed rather than the number of scans.

Diff Detail

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

Event Timeline

kib added inline comments.
sys/vm/vm_pageout.c
946 ↗(On Diff #40846)

Using uint64 sounds unnatural for me. Why not use longs ? I doubt that we can accumulate so many pages from the work that it overflows ulong on 32bits.

This revision is now accepted and ready to land.Mar 28 2018, 5:34 PM
sys/vm/vm_pageout.c
946 ↗(On Diff #40846)

I considered doing that, but:

  • In the case of ndirty, we may multiply it by a potentially large factor, and I think it's possible for the multiplication to overflow in extreme cases.
  • If ndirty is very small, nfreed may grow quite large before we trigger a background laundering. In the pathological case where ndirty stays equal to 0, nfreed will never be cleared.

Both of these cases are quite unlikely as you point out, but for peace of mind it seems preferable to keep the variables 64-bit.

This revision was automatically updated to reflect the committed changes.