Page MenuHomeFreeBSD

Ensure that the pageout daemon runs on schedule
Needs ReviewPublic

Authored by alc on Jun 10 2018, 10:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 29 2024, 5:25 PM
Unknown Object (File)
Jan 3 2024, 4:27 PM
Unknown Object (File)
Jan 2 2024, 3:05 AM
Unknown Object (File)
Sep 30 2023, 1:40 PM
Unknown Object (File)
Sep 21 2023, 5:35 PM
Unknown Object (File)
May 26 2023, 4:02 AM
Unknown Object (File)
Dec 24 2022, 9:46 PM
Subscribers

Details

Reviewers
jeff
kib
markj
Summary

In vm_pageout_worker(), we do not account for the time that it takes to scan the active and inactive queues, or delays in starting vm_pageout_worker(), when computing the sleep time. Consequently, as the amount of time that vm_pageout_worker() spends scanning the queues varies, so does the timing of the calls to pidctrl_daemon(). For example, under a PostgreSQL workload, I see the interval between calls stretch by 10+%. This change computes a sleep time based on the next desired execution tick for the controller.

On my test machine, calls to pidctrl_daemon() often occur one tick earlier than expected, and this triggers the "multiple calls within an interval" case. Suppose that calls occur at time t, t+99, and t+199. The effect of the "multiple calls within an interval" handling at time t+99 is that the integral term has much reduced impact on the output.

Test Plan

I'm really curious what values you see for debug.counter1. After about 2.5 hours of running a PostgreSQL workload, I see:

debug.dt: 89
debug.counter: 7
vm.domain.0.pidctrl.output: 11609
vm.domain.0.pidctrl.error: -38
debug.foo1: 2156480700
debug.foo2: 2156480700
debug.counter1: 7705

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

The change tightly alias the worker wakeup to the period ticks. It might result at least in the cosmetics issues with the load average.

Regarding the testing section, after running pgbench in a loop for roughly 12 hours, I see:

debug.dt: 95
debug.counter: 632
vm.domain.0.pidctrl.output: 10481
vm.domain.0.pidctrl.error: 99
debug.foo1: 2205322400
debug.foo2: 2205322400
debug.counter1: 7
In D15749#332911, @kib wrote:

The change tightly alias the worker wakeup to the period ticks. It might result at least in the cosmetics issues with the load average.

Isn't this addressed by the P_SYSTEM flag, specifically, that we don't include processes with the P_SYSTEM flag set in the load average?

In D15749#355638, @alc wrote:
In D15749#332911, @kib wrote:

The change tightly alias the worker wakeup to the period ticks. It might result at least in the cosmetics issues with the load average.

Isn't this addressed by the P_SYSTEM flag, specifically, that we don't include processes with the P_SYSTEM flag set in the load average?

I more do not like the sync with ticks, and the LA was only (bad) example. I believe a small amount of noise in the sleep period would be beneficial regardless of P_SYSTEM.