git: 025287a38dac - stable/14 - vm_pageout: Make the OOM killer less aggressive
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 15 Jul 2025 13:46:35 UTC
The branch stable/14 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=025287a38dacfbeaa570f35650396fb016f54c9e
commit 025287a38dacfbeaa570f35650396fb016f54c9e
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-06-27 13:09:39 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-07-15 13:46:24 +0000
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)
---
sys/vm/vm_pageout.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index 83f655eb852e..378fd3b834de 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -1821,8 +1821,14 @@ vm_pageout_mightbe_oom(struct vm_domain *vmd, int page_shortage,
{
int old_vote;
+ /*
+ * Do not trigger an OOM kill if the page daemon is able to make
+ * progress, or if there is no instantaneous shortage. The latter case
+ * can happen if the PID controller is still reacting to an acute
+ * shortage, and the inactive queue is full of dirty pages.
+ */
if (starting_page_shortage <= 0 || starting_page_shortage !=
- page_shortage)
+ page_shortage || !vm_paging_needed(vmd, vmd->vmd_free_count))
vmd->vmd_oom_seq = 0;
else
vmd->vmd_oom_seq++;