From nobody Fri Jun 27 13:15:50 2025 X-Original-To: dev-commits-src-main@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 4bTGJl34Kbz5ymC1; Fri, 27 Jun 2025 13:15:51 +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 4bTGJl274tz3rZd; Fri, 27 Jun 2025 13:15:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751030151; 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=Gol+9nwz2nA4Rf+sgnUYRrIUa8WIHjQVORULthMk6d0=; b=hjXVcvRwta8mLMlkHDs5u/p7717B22KWX0ZQdaFxPJdFb5rqmoytd2HIYquXywNDxIXOHg SZLwM/rXwnVBRq+iUDKw+2+u5o3WQXWowFYmfCNmVPahiUbW3fB7qnaqRV8H/uVHVXPLmL ryo8JzefTuK0XuGPywIzp6Ztj/acGuWrIOb9Z7u24gO9xYsRGfIt96QTbJ26r97InWUdKh njm8v6XxB+gXPOJWwxKNflYXE8IY6O7ADvftlU2/waIES5gErzEhmkB0UGj69xJtohmx8q rJD6HtQFtvqSrpg3BGG6CLafABdmZYJps7C1gS81enRgAcLU7RHtiAGP+d3oMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751030151; 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=Gol+9nwz2nA4Rf+sgnUYRrIUa8WIHjQVORULthMk6d0=; b=XvdO3WlkABs2ZiIxDBSEzarZL6GleR7qWSTfsU11luu2gATRtWTMw4wWUXDmWB4UBnwHcO IWyz7ChvCQrV7RL6C/jpi5N9fz2ntY9CyZmginTsYJ8LK2sWXnaMZeWLpKVcT9rbABoS3L q9MLKwjwvyarv9hnDcVKdeQ3QtldN8KRKg4ZLUI1Pw4pV3tJozjXrotj3XuUvf8PZcwkUZ Cy6/OIhERVXmbqpCGTadzEl5sqIukfJA1E4I8pELZuOV1nKC9Brus7eFQlU1g2BUf9VGFj IL/5HAwEegNp9bc6M1eV2fpm7HwUrQ5pGgVjM0KZhmkZOVHNIxvfkYtIF5hN5w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751030151; a=rsa-sha256; cv=none; b=XxA3MH9F+oaWv2apFw2jEdQgF00WMu40lIcJKHLcWs4Xvj26/Z3fqm5SBr4/icmbK+C7Wm FDdi0MraVvsuThIpCmhXEPSY6x5DSfkQ1QCDRoBG9LZ7gywOI50noqKC6gdVK2gUTg4vsH z9LbG0Pqj9EjtmCG0QWFBOHnWt9dnf76u2VnfXGgH+tPlpNCDJ+9q+jGC8427jZq6czzA2 3xMNImP//VvdG7gfvgbzKrbgFXaB5a8x52lszFA0ZJOuziBvRC3yLGU7IB8LJRkJk5EkYf OEb8TIH34JsI/2D+HWqL5k6MZ2HUdSIKdbBtYIRAJmKi3U3AYQmNUMR4p5oOdQ== 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 4bTGJl1FkSzqK3; Fri, 27 Jun 2025 13:15:51 +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 55RDFour024252; Fri, 27 Jun 2025 13:15:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55RDFoFl024249; Fri, 27 Jun 2025 13:15:50 GMT (envelope-from git) Date: Fri, 27 Jun 2025 13:15:50 GMT Message-Id: <202506271315.55RDFoFl024249@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 78546fb0e321 - main - vm_pageout: Make the OOM killer less aggressive List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 78546fb0e3215c07f970c1bcbf15bba2f5852c76 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=78546fb0e3215c07f970c1bcbf15bba2f5852c76 commit 78546fb0e3215c07f970c1bcbf15bba2f5852c76 Author: Mark Johnston AuthorDate: 2025-06-27 13:09:39 +0000 Commit: Mark Johnston CommitDate: 2025-06-27 13:14:22 +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 --- 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 6d3139e58c5a..b500eb8156bc 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1784,8 +1784,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++;