Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Sep 2022 02:04:05 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 28c771673f0b - stable/13 - vm: make vm.overcommit available externally
Message-ID:  <202209300204.28U245NU099013@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=28c771673f0b2ac5fcf886cd7dcbc3c80066f538

commit 28c771673f0b2ac5fcf886cd7dcbc3c80066f538
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-09-12 19:31:30 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202209300204.28U245NU099013>