From nobody Thu Oct 22 17:32:11 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 4j9YB42k3Yz6xPCc for ; Thu, 22 Oct 2026 17:32:12 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4j9YB36gbmz3HDy for ; Thu, 22 Oct 2026 17:32:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792690331; 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=i9+FEZ1Hv56bvWjXt4goKSVWm16kABP+IEmzpHSxELo=; b=lX6GlK/DcI2q6kdspdRcNQwQzHTggXoeMxRl7tytP6xzQoB79RUSMcBKNGq7BotuzgKHX+ SPHzzbM6kPzx5C3VnKfAsHbq7xKQE56S+v7BlszerYZneAz43y1HwSqdk3bvQIiSD0v7QT xgeqBssByzQTikmUTYZrL0zm21EhNl5Vdt7P13t5XybzS0iEUzHtWX5b92VZJJlL9AekDc IrsIgOnJvsvf9LmMEv+1RrDdXnko2uhRTiohVBgvLbQbFDXAz5gLROqWOKfZissPI3u3df nlIJbMin1e7c3Bj4c1ziK+vAobPzDYsp/0wi5vy5iOttrmYh5btPUqz59z6hwg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1792690332; b=DK1PAwaUMR2LnxVbM1hA/xaEA7GElDbvbaeBTjMlr5PPzvfzv//0Fn3sdfjwZ0sJOxKx5s 5Ze+ANIM8ZcEVGDHMSaq7/sUIfV9NPDwGbcq9pLCFxcmw/Mnc/kqY4OqtEB+gdVJ8CdlZo JeXIs5GiEJfxeY2VaEZn+Jw6CNYCieWyQ9SvjllTF2Af0f4L6ec/l/Das70owFmh0NF3OC 8zsnuHObtC9fbaifIKQYjV2uU6uP70un+20Ka9PG8VJbb2IK1dmGK+m42h1MviiMleIxfd ZPiA/VzEx4jqm+cpMT4cL8rdNHsDq9OLBNnrt7OBVZ8ClH9uxNQ4AlZ/VrYZmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792690331; 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=i9+FEZ1Hv56bvWjXt4goKSVWm16kABP+IEmzpHSxELo=; b=x9XTnGCGflwAw4C+ng7P5MPh0mqoEpTDgqIHfsBX6+5doEHVdggK5bfnZeVk6OJ4BNoUjo LbPUmQxhaHzsaqYOTsDgqdrCfDhv0pv4SMXPyEjX792CkkqbDkT40TSll8rVRu97FceUm6 m271+f19Piw768LBK2TP8v80Nb32W4OYV2XMaarwyh1RODFSZcH3T6NdimomW/5JLcbEuf +O+AIzswf/a6OL0poe4z2UQY9y4b78ns5wqYJN7QzdV6haxkBzTqSIgcTw52IGbueFK7a1 JNFgrUvjRcUgFN4zKrXuWi9hEzaeJW/FXX0oprLH6EXCoQxzDhj2gOt3tM/51A== 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 4j9YB36KrKzsbb for ; Thu, 22 Oct 2026 17:32:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d0c5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 22 Oct 2026 17:32:11 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: e8f11e7dce57 - stable/15 - vm_swapout: Restore handling of RLIMIT_RSS List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository 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/stable/15 X-Git-Reftype: branch X-Git-Commit: e8f11e7dce5775b13a295a5d14547863d849e872 Auto-Submitted: auto-generated Date: Thu, 22 Oct 2026 17:32:11 +0000 Message-Id: <6ada489b.3d0c5.7f4d6e40@gitrepo.freebsd.org> The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e8f11e7dce5775b13a295a5d14547863d849e872 commit e8f11e7dce5775b13a295a5d14547863d849e872 Author: Mark Johnston AuthorDate: 2026-09-29 19:45:25 +0000 Commit: Mark Johnston CommitDate: 2026-10-22 15:45:41 +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 (cherry picked from commit da0764f23554ef446003b5f2ab4e535a3329b0ab) --- 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 07d94ab61547..ed708da36683 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -5360,7 +5360,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;