From nobody Fri Sep 30 02:04:05 2022 X-Original-To: dev-commits-src-branches@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 4Mdtnd4jBDz4dfG2; Fri, 30 Sep 2022 02:04:05 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Mdtnd4BTtz3dn5; Fri, 30 Sep 2022 02:04:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664503445; 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=Yxq/W1PpDiRmxGhrVW8a5+MmFBWIve/F+XqXyRp7GTY=; b=pECzO4DZHsDJfkhDYDJ/nb+7HZZeSx9CAPx4exFuzcGb7QHp4nIn4PBAg9B9jFUAAadYI3 T931CXgD8CQr5UEl+dM/cckWCPPEt2npmfRD+PhpYSuYkLAboXA2xaIBxmDIrquiO/jl4J sLEvz39wXMYBeHr9ZDct//vYyK8h1Gk8vTU897sFM4sDSN83VbEdtrm+kDn72FX0U1i0ff yknruEGm3tNq05wFcgULzByNNXOn0Qvj7JCETFDRnpc4WMbJrpPOm2oteOZRI1Ro5fDvFR JLJFHH7SjpBzzwr1q49BltO8D2L9U17SQw5vA6gbq6Q3TVp7PUUA0N63oX69bQ== 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 4Mdtnd3Fr6z11c4; Fri, 30 Sep 2022 02:04:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 28U245N7099014; Fri, 30 Sep 2022 02:04:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28U245NU099013; Fri, 30 Sep 2022 02:04:05 GMT (envelope-from git) Date: Fri, 30 Sep 2022 02:04:05 GMT Message-Id: <202209300204.28U245NU099013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 28c771673f0b - stable/13 - vm: make vm.overcommit available externally List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 28c771673f0b2ac5fcf886cd7dcbc3c80066f538 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664503445; 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=Yxq/W1PpDiRmxGhrVW8a5+MmFBWIve/F+XqXyRp7GTY=; b=aJ9svFcF5DtvudxksHwaNCRTQ8dhSETzSk0UZaW/xf53L0vREYGKGuEjVBKqrAe58ulo3x GbqH/yaWk84djcc44gUAI5FHZlITslz3yeKb6GzJ+3SdQ+o3K8yrGZtwSmxub6/SH8XXE3 ofIuUZR7Qnf79XimaQLEJ5StAMzMB8LdyNlJDr2dxRh826XrcpGV91Hq2Ze1sqka96B9kK 85JkD0AKPoZ/licQrQxEu1CReCpP+s41fQN0vbkWnD9pWEquGOY3x0FGTTUagkc/1ge1Ry I8UrEwek8Q5mGGlv5YgpQv4mKIj3tCbC1yT2JoU5zk91izeHvSQyJ/6qfwUpHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664503445; a=rsa-sha256; cv=none; b=cTLMpPyQEmy9lrml6EAZAfnksw0pmYzBxNRVlVLF6XYQeC69pP+R7QypDfRnAVtQC92W1h nLOL1vXplsgwP+FJL1Ui6iTG6BcigYlwdPK98TPp3/lnjQVRLeViWJj4CD8oOwq0zUxB+a Y0Jm5b4qRTC0x7YmaIrPgl/H2v/H6L2ORmDrpC8tuGvv1VnW9BSMLW79c+QfsvqMARW0iq uaxFKk7/K14eeVg7pxN4K/H7ZNQ+2e9Y93wzlTz4Bkog2y3DtH67MKLR4ut3ICsADq/ynI cas4k7iyzwEHjh/A/xV69OzR5NkYc7Y2doSP9Cf8WQWIhgetOQvq93CcIulySA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=28c771673f0b2ac5fcf886cd7dcbc3c80066f538 commit 28c771673f0b2ac5fcf886cd7dcbc3c80066f538 Author: Konstantin Belousov AuthorDate: 2022-09-12 19:31:30 +0000 Commit: Konstantin Belousov CommitDate: 2022-09-30 00:29:09 +0000 vm: make vm.overcommit available externally (cherry picked from commit a6cc4c6e98eb65d7cc15c16262ad6053763fe18a) --- sys/vm/swap_pager.c | 11 +++-------- sys/vm/vm.h | 6 ++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 394058b8ccea..36d2bd0adf0e 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -169,8 +169,8 @@ SYSCTL_PROC(_vm, OID_AUTO, swap_total, CTLTYPE_U64 | CTLFLAG_RD | CTLFLAG_MPSAFE &swap_total, 0, sysctl_page_shift, "A", "Total amount of available swap storage."); -static int overcommit = 0; -SYSCTL_INT(_vm, VM_OVERCOMMIT, overcommit, CTLFLAG_RW, &overcommit, 0, +int vm_overcommit = 0; +SYSCTL_INT(_vm, VM_OVERCOMMIT, overcommit, CTLFLAG_RW, &vm_overcommit, 0, "Configure virtual memory overcommit behavior. See tuning(7) " "for details."); static unsigned long swzone; @@ -190,11 +190,6 @@ SYSCTL_COUNTER_U64(_vm_stats_swap, OID_AUTO, free_completed, CTLFLAG_RD, &swap_free_completed, "Number of deferred frees completed"); -/* bits from overcommit */ -#define SWAP_RESERVE_FORCE_ON (1 << 0) -#define SWAP_RESERVE_RLIMIT_ON (1 << 1) -#define SWAP_RESERVE_ALLOW_NONWIRED (1 << 2) - static int sysctl_page_shift(SYSCTL_HANDLER_ARGS) { @@ -286,7 +281,7 @@ swap_reserve_by_cred(vm_ooffset_t incr, struct ucred *cred) prev = atomic_fetchadd_long(&swap_reserved, pincr); r = prev + pincr; s = swap_total; - oc = atomic_load_int(&overcommit); + oc = atomic_load_int(&vm_overcommit); if (r > s && (oc & SWAP_RESERVE_ALLOW_NONWIRED) != 0) { s += vm_cnt.v_page_count - vm_cnt.v_free_reserved - vm_wire_count(); diff --git a/sys/vm/vm.h b/sys/vm/vm.h index 72b0191298d9..7e29f9fd3370 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -164,6 +164,12 @@ extern int old_mlock; extern int vm_ndomains; +/* bits from overcommit */ +#define SWAP_RESERVE_FORCE_ON (1 << 0) +#define SWAP_RESERVE_RLIMIT_ON (1 << 1) +#define SWAP_RESERVE_ALLOW_NONWIRED (1 << 2) +extern int vm_overcommit; + #ifdef _KERNEL struct ucred; bool swap_reserve(vm_ooffset_t incr);