From nobody Fri Sep 16 20:25:32 2022 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 4MTlv1092kz4d6lZ; Fri, 16 Sep 2022 20:25:33 +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 4MTlv06kqmz3MDh; Fri, 16 Sep 2022 20:25:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663359932; 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=/n729kyaVmtamMA/9MB+94fKPS7NeeKwW0hfCnafvjg=; b=UwmP2aLEj+hWW/1opotYQpONavPaur7a1ThsMi1qauFDRcj7yBlpzcS4b6Jd9t0mk3KwrK SfEMU5E8K2iUrRtQaaPgr84KAXsNayMbwgxDfIfsuansZnpzPaeZBWnnLbVhe2biJIHajp 9J2nf7aF6jbsYfBMP127AbhN4dP7BI1r5AuTVgJjT8MNsV7Y/Ks8zlGAMyOb8rr5Z+C4Kq TeVA+H6yqXP3tpZzWnlcamTcC7o+QnMA0kUW2Dpp9kM+ePjg/XcIaH/w1yphwIWQ1P1zOZ /X/xMZs5SZLEobZMG+aqJutXqVnBq66etzC6SjvMoQi99m+EMS13n2ZmzrLDlw== 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 4MTlv05WVxzTC1; Fri, 16 Sep 2022 20:25:32 +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 28GKPWZr026186; Fri, 16 Sep 2022 20:25:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28GKPW6x026185; Fri, 16 Sep 2022 20:25:32 GMT (envelope-from git) Date: Fri, 16 Sep 2022 20:25:32 GMT Message-Id: <202209162025.28GKPW6x026185@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: a6cc4c6e98eb - main - vm: make vm.overcommit available externally 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: a6cc4c6e98eb65d7cc15c16262ad6053763fe18a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663359932; 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=/n729kyaVmtamMA/9MB+94fKPS7NeeKwW0hfCnafvjg=; b=gTljIVapT//YkNA65ncTuBXmYQR7Cvl9ZbQrsACi1doTTqVY5VNoADfKIvn6zgYawwnMeZ +6IezM6wzrLIFzFeSjsjE1M76FfKCO9RZZJkJVt49T4YdMU0ctbqASXMjYDOoZAUuqoy7C LXNKqAucqhyPS2GrM2ucBMAGjd5ckZihpLrVADhQVuwyL/XBf7l3SGnqxBffPyrSIMIjwE RV+EqEAq5B8WvjpGc7FgcUThjB2020EG/kaOz4BCzzdH53BWjOaFLfK3xAsQ6n/kPm1r0H E8Js0MA39NldSx3R9CRE1dDrinX+s8W5DVddunMEzku70Ic6UrLV3Ur5+rus7g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663359932; a=rsa-sha256; cv=none; b=U3k3eQOz5pXEK5fW5IhtWzD7u6rSaaI/rE0+tkcvHQaVcwcJGaTzJUBTyOC+z+J+bpOj7u 74/7VR4JFkwTSJlZKsevg0PcaXyT+azr1bBQolAW72VhXq+3opJRY9mnlYMNFIH6qDu9vS De+O/6blgufIjnAox9I7By+Wn4dkVeavT/dSuhkrWN4W6roXilTy0S6yu6R4WlMOFOyO+K X4YTHTM4bf1wQQXJp3mJNM2hj7D9XYcl1jOWNC67+rUJfZSXHJCoUYuH3KcI1Ek4R0lynR pOWQepolcji2GKkWUD0idheQG7UqiKtlqk1BAP0t6HbazQVs5j4HN2WRmCa8Pw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a6cc4c6e98eb65d7cc15c16262ad6053763fe18a commit a6cc4c6e98eb65d7cc15c16262ad6053763fe18a Author: Konstantin Belousov AuthorDate: 2022-09-12 19:31:30 +0000 Commit: Konstantin Belousov CommitDate: 2022-09-16 20:22:49 +0000 vm: make vm.overcommit available externally Reviewed by: brooks, imp (previous version) Discussed with: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36540 --- 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 67cc3bf017d2..071296ad6443 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, "QU", "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 d0cc399dab79..df53dc340ecd 100644 --- a/sys/vm/vm.h +++ b/sys/vm/vm.h @@ -165,6 +165,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);