Page MenuHomeFreeBSD

Eliminate the "pass" variable in the page daemon control loop.
ClosedPublic

Authored by markj on May 19 2018, 7:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 28, 9:58 AM
Unknown Object (File)
Nov 21 2024, 9:02 AM
Unknown Object (File)
Nov 17 2024, 1:10 PM
Unknown Object (File)
Oct 14 2024, 10:01 AM
Unknown Object (File)
Oct 4 2024, 4:31 PM
Unknown Object (File)
Sep 29 2024, 11:02 PM
Unknown Object (File)
Sep 27 2024, 10:55 AM
Unknown Object (File)
Sep 23 2024, 9:36 AM
Subscribers

Details

Summary

Only scan the inactive queue when the PID controller outputs a positive
value. Move the lowmem eventhandler invocation to a separate subroutine.
Fix up some stale comments.

Now we pause() for 0.1s after an inactive queue scan failed to meet its
target. In a separate change I'd like to pause() only if the active
queue scan met its target *and* the inactive queue scan failed to meet
its target.

As a side effect, this fixes a serious bug: after r329882, we never
reset pass to 0, so we are invoking the lowmem handlers every 10
seconds even when no memory shortage is taking place.

Test Plan

So far I've only verified that we boot.

Diff Detail

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

Event Timeline

markj edited the test plan for this revision. (Show Details)
markj added reviewers: alc, kib, jeff.
markj added a subscriber: avg.

Ping?

After a cursory reading, I'll say that I like the changes. I'll try to read it carefully in a day or so.

In D15491#327721, @alc wrote:

Ping?

After a cursory reading, I'll say that I like the changes. I'll try to read it carefully in a day or so.

Thanks! No rush.

I just realized that this change has the same goal as D13644. The discussion there is still relevant; in particular, with the PID controller change it now doesn't make sense for v_free_target to be set as high as it is: the controller will produce a positive output as soon as v_free_count < v_free_target, and the page daemon runs the controller once every 100ms. In other words, we start freeing pages more or less immediately after v_free_count drops below v_free_target. I plan to address that, but in a separate change.

I just realized that this change has the same goal as D13644. The discussion there is still relevant; in particular, with the PID controller change it now doesn't make sense for v_free_target to be set as high as it is: the controller will produce a positive output as soon as v_free_count < v_free_target, and the page daemon runs the controller once every 100ms. In other words, we start freeing pages more or less immediately after v_free_count drops below v_free_target. I plan to address that, but in a separate change.

The problem with lowering the v_free_target is you end up with stalls under heavy memory consumption. It may be an ok tradeoff for more memory if you can change it appreciably. We could also change the rise time for the PID controller to help.

As we discussed, we really need to be more conservative about when we call reclaim. I think we have some good options to pursue but I don't want to hold this fix up. I had the pass fix in my branch for months and forgot to commit.

This revision is now accepted and ready to land.May 31 2018, 11:36 PM
This revision was automatically updated to reflect the committed changes.
head/sys/vm/vm_pageout.c
1351

The comment still mentions "pass".

head/sys/vm/vm_pageout.c
1351

How about, "Returns true if enough pages were freed by the inactive queue scan to address the shortage."?

head/sys/vm/vm_pageout.c
1351

I would suggest moving the phrase "the inactive queue" to the first sentence, and then the second sentence can be very short and simple.