vm_pageout: Make the OOM killer less aggressive
A problem can arise if we enter a shortfall of clean, inactive pages.
The PID controller will attempt to overshoot the reclamation target
because repeated scans of the inactive queue are just moving pages to
the laundry queue, so inactive queue scans fail to address an
instantaneous page shortage. The laundry thread will launder pages and
move them back to the head of the inactive queue to be reclaimed, but
this does not happen immediately, so the integral term of the PID
controller grows and the page daemon tries to reclaim pages in excess of
the setpoint. However, the laundry thread will only launder enough
pages to meet the shortfall: vm_laundry_target(), which is the same as
the setpoint.
Oonce the shortfall is addressed by the laundry thread, no more clean
pages will appear in the inactive queue, but the page daemon may keep
scanning dirty pages due to this overshooting. This can result in a
spurious OOM kill.
Thus, reset the sequence counter if we observe that there is no
instantaneous free page shortage.
Reviewed by: alc, kib
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D51015
(cherry picked from commit 78546fb0e3215c07f970c1bcbf15bba2f5852c76)