From nobody Tue Sep 29 20:01:56 2026 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 4hvTbS5wW2z6v4gL for ; Tue, 29 Sep 2026 20:01:56 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hvTbS58yPz4g3g for ; Tue, 29 Sep 2026 20:01:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790712116; 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=j1wwSVCuzCdg8Ws0WC2uXd3zR1NUlWdaSe+Qyd6Uyjo=; b=BU1BGHNoqk4W32H72Qbt/olagIRvyxDrsjgrBORo9rZXDJCkZyVxPWoBlA+X26pMLLQovt f2LbrdSGDGuyOLDU91Ywif4QdsWhZbqtN7ObaOu94mJXAbtGb+VRRNkwWJru5FsP4kgUWo 8xebGb6iBqbmneMUupob3m9ym1l/k/6EnsDZ9QQ0IbxHXK/plqE+86YHn9SKReQWtboc1X BFZI83iKevoINnSrBXBaAvHIKjm4Fxb3+5rDBNFWSyT0vKDFUrsD2mEQEQtTgotLeqOIZD EHmSCWKI0KJ3iGea/NGYw07025xGV9bVSARkBB27isLcGLqTmy93JGFCs1Y+Rg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1790712116; b=GXX7fX+g2CQVsJkgCzE3Us5zTDaaXW0xHnw9J5xromq7G9yG0fHNKBX5OiH4hKFm+mVIZT zpHS8iG5355WT6tZOD84C8+KHupehjYw5YNm484k9COe6vS/G3EZFbpJeUqqOF5aEBqa79 YXglNMG4j+qayDostFHmToKSUPC97niRK2XzIExeSRObiFBZzQVgeBairoCbP3WS7lR7w8 Kez6C9KCoYvIAPMaAKadhPVClK8TCwK+YFeiGJekP7omVrd7xdU41tKdVBlJc5pgKVsd90 qms+wBLJZFbAICFQc2kAc7aNtowz8DQKDHw9qLv4Cr3thEghiwMd/Q4gsA0Wqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1790712116; 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=j1wwSVCuzCdg8Ws0WC2uXd3zR1NUlWdaSe+Qyd6Uyjo=; b=JZ8uAtuUocDYeGkwo7Fs4hpy2SAYzbQao3zEMul7WVCP2vyCJu5On3fdB+ZZ9C2x0leG+l TC7ScInwtaseymnD/EXLcUgU8Z15/l4mc6T7h4ZJq9qje0AwPJ6eJX4raukRvXMIcBoVku LZj6SSJk/ykT2XBcNhVv9qmXNLzpdOs3J1DPDx6M8Bon6bFlDGGj7Vu6MK9TA9FxwKYest 5PfDS1l7y2jGUXWK/p0elxadWga94jI/Y8En4FZ8MOcjM6Ai46hWy9QgJRYZxg94s+Uwp5 Tx4O2DpNFhsGaSSM3B/RpFEvyPUBNuuWZQijb+RS7EcYxU8WYDyF9g2PgKBq7w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hvTbS4DVMz1RpJ for ; Tue, 29 Sep 2026 20:01:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1a014 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 29 Sep 2026 20:01:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: da0764f23554 - main - vm_swapout: Restore handling of RLIMIT_RSS 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: da0764f23554ef446003b5f2ab4e535a3329b0ab Auto-Submitted: auto-generated Date: Tue, 29 Sep 2026 20:01:56 +0000 Message-Id: <6abc1934.1a014.4cb0cbb5@gitrepo.freebsd.org> The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=da0764f23554ef446003b5f2ab4e535a3329b0ab commit da0764f23554ef446003b5f2ab4e535a3329b0ab Author: Mark Johnston AuthorDate: 2026-09-29 19:45:25 +0000 Commit: Mark Johnston CommitDate: 2026-09-29 20:01:45 +0000 vm_swapout: Restore handling of RLIMIT_RSS In commit 13a1129d700c, I removed the mechanism by which the pagedaemon signals the swapout thread when page reclamation is unable to keep up with demand. This is because the swapout thread's main action in this case is to swap out sleeping processes, but we removed this support. However, it had the secondary effect of causing the swapout thread to enforce RLIMIT_RSS when racct is not enabled. Without it, if racct_enabled is false, nothing ever kicks the swapout thread. Restore the old behaviour of trying to enforce RLIMIT_RSS when the page daemon is unable to keep up with demand. I'm not at all convinced this is a good way to implement the limit, but the change wasn't intentional, so let's restore it for now. Fixes: 13a1129d700c ("vm: Remove kernel stack swapping support, part 1") Reviewed by: olce, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D56142 --- sys/conf/files | 2 +- sys/vm/vm_pageout.c | 8 +++++++- sys/vm/vm_pageout.h | 2 ++ sys/vm/vm_swapout.c | 18 +++++++++++++++--- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 495881e7ae0c..9dc3d34f3bd6 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -5413,7 +5413,7 @@ vm/vm_pager.c standard vm/vm_phys.c standard vm/vm_radix.c standard vm/vm_reserv.c standard -vm/vm_swapout.c optional racct +vm/vm_swapout.c standard vm/vm_unix.c standard vm/vnode_pager.c standard xen/features.c optional xenhvm diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 418a9cff8abf..fa4c356258f0 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1683,7 +1683,7 @@ reinsert: * results to present a coherent view of paging activity on this domain. */ static int -vm_pageout_inactive_dispatch(struct vm_domain *vmd, int shortage) +vm_pageout_inactive_dispatch(struct vm_domain *vmd, u_int shortage) { u_int freed, pps, slop, threads, us; @@ -1796,6 +1796,12 @@ vm_pageout_inactive(struct vm_domain *vmd, int shortage, int *addl_shortage) */ vm_pageout_mightbe_oom(vmd, page_shortage, starting_page_shortage); + /* + * Kick the swapout thread to enforce RSS limits. + */ + if (page_shortage > 0) + vm_swapout_run(); + /* * See the description of addl_page_shortage above. */ diff --git a/sys/vm/vm_pageout.h b/sys/vm/vm_pageout.h index 5cfb6e5ca198..7413960eb9b4 100644 --- a/sys/vm/vm_pageout.h +++ b/sys/vm/vm_pageout.h @@ -103,5 +103,7 @@ void vm_wait_severe(void); int vm_pageout_flush(vm_page_t *mc, int count, int flags, bool *eio); void vm_pageout_oom(int shortage); +void vm_swapout_run(void); + #endif /* _KERNEL */ #endif /* _VM_VM_PAGEOUT_H_ */ diff --git a/sys/vm/vm_swapout.c b/sys/vm/vm_swapout.c index e85a049f46fe..a0c61c33fa5a 100644 --- a/sys/vm/vm_swapout.c +++ b/sys/vm/vm_swapout.c @@ -135,6 +135,19 @@ MTX_SYSINIT(vm_daemon, &vm_daemon_mtx, "vm daemon", MTX_DEF); static void vm_swapout_map_deactivate_pages(vm_map_t, long); static void vm_swapout_object_deactivate(pmap_t, vm_object_t, long); +void +vm_swapout_run(void) +{ + static int lastrun = 0; + + mtx_lock(&vm_daemon_mtx); + if (ticks - lastrun >= hz || ticks < lastrun) { + wakeup(&vm_daemon_needed); + lastrun = ticks; + } + mtx_unlock(&vm_daemon_mtx); +} + static void vm_swapout_object_deactivate_page(pmap_t pmap, vm_page_t m, bool unmap) { @@ -287,15 +300,14 @@ vm_daemon(void) if (racct_enable && vm_daemon_timeout == 0) vm_daemon_timeout = hz; - while (TRUE) { + while (true) { mtx_lock(&vm_daemon_mtx); msleep(&vm_daemon_needed, &vm_daemon_mtx, PPAUSE, "psleep", vm_daemon_timeout); mtx_unlock(&vm_daemon_mtx); /* - * scan the processes for exceeding their rlimits or if - * process is swapped out -- deactivate pages + * Scan for processes exceeding their rlimits. */ tryagain = 0; attempts = 0;