From nobody Tue Jul 15 13:46:35 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bhL7w2sM8z62QDT; Tue, 15 Jul 2025 13:46:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bhL7v6Jw4z3snk; Tue, 15 Jul 2025 13:46:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752587195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kRZCUtJFa4zKzfMjKB+OzSKNYeV4V3+TTBPMI3xkKGU=; b=rvvO0dPzslT+TePPdO8nJPt9xyLmTsm33AkH1tUmLHCpAMGVhOSb7sM9L59FFupWdLJc29 PsHkGdneYkXKiDhCIkBamebq6hmEwANaWnb3b66ck4HaFs8ZQ7yE5iBucGqVsD5j6Cs70I +GfnjS6Ptwfc+p46uvK6RMcIJAST8j5x5Ii6K3WfeDyZTuXivk8AV+eXhn+QtR/xMGSR2t 2WpVK0htoiM0A53vurlPOouYcHYraayXSOg/COnsypoMaVPIBFFiexa+8i4nwxNThFyxuz mWGFLJw3IPfK67DDNWDbNZY0sS6dKCLKoMBFksEcz4tNjus0lnhk83JcFu2BIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752587195; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kRZCUtJFa4zKzfMjKB+OzSKNYeV4V3+TTBPMI3xkKGU=; b=hxobyK6znO1H/eFjOvl1Dp/BJT9AmfSDuVkVdsn2OPD0QzH4iOo20pV7Z+AYyr5J8dEVR4 vn4ZrDNdE+Wk15L+AV7gVSjOWOzPsAfKO4612cx/WcvkyEGU8ClwWsgTJIRo1ZkCxTWORx +V9yDguMty0mMIwKax9w/KuUFwv3gRf8llZbMwMCrZawB+554XOUZ5hGlvnpe50Ql9rNmi pa1w/huulmK+AvMFgUoWz7oy5hEqWPy3d4XhqoWr2DVT9UsoHqRXTnv3UdUoGR0E9z64ka DnCB4UTEBtK4LxO8VnxtNziKy/+fls83j2K/ZcIj/iR91t35C0kQOyR2jniPhw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1752587195; a=rsa-sha256; cv=none; b=nIDp3cftrCQy+3OvHdW8QbUhoh7CiC3EowrhmqTeElxoQghi/cCpcKpj45LsJH2Ag2EcYq gg5I+mGBmcx8JgN2moEevIuKxwZaYFh+5XWrgOXiuKHcsbwzaREBfyfgWWbNZWXucc9tm8 Y+B18ZL/6iqs6lIgSHMW3OOaEC9flPmQiNUS5jcFhFYzeFvBnGnzjBGJ2dj8/4AiIL71Z9 3hTEh12jjdCixRmc6hAHVuF0U56L1sAenr6Dok7Hv0lDK6pqWtib+V6ZoOwI6xsOz34QR4 q1CkVjTUnI9Anw2zc+M9BvTS0if24q4A4tov37kSHtaxXRbqP/WIbSmqnXQxcA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bhL7v5YYyzhwc; Tue, 15 Jul 2025 13:46:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56FDkZim041878; Tue, 15 Jul 2025 13:46:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56FDkZXf041875; Tue, 15 Jul 2025 13:46:35 GMT (envelope-from git) Date: Tue, 15 Jul 2025 13:46:35 GMT Message-Id: <202507151346.56FDkZXf041875@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 025287a38dac - stable/14 - vm_pageout: Make the OOM killer less aggressive List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 025287a38dacfbeaa570f35650396fb016f54c9e Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=025287a38dacfbeaa570f35650396fb016f54c9e commit 025287a38dacfbeaa570f35650396fb016f54c9e Author: Mark Johnston AuthorDate: 2025-06-27 13:09:39 +0000 Commit: Mark Johnston 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++;