summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2014-05-12 20:48:04 +0000
committerdes <des@FreeBSD.org>2014-05-12 20:48:04 +0000
commit7885a006b9088e8c59584316c48bb85a517ee6b9 (patch)
treede5214fca2d019bd5b521bf5273eec5c80de2c0a /sys/vm
parent62542709cb97d9f3588375fd439ad80ebd869b76 (diff)
downloadFreeBSD-src-7885a006b9088e8c59584316c48bb85a517ee6b9.zip
FreeBSD-src-7885a006b9088e8c59584316c48bb85a517ee6b9.tar.gz
MFH (r264966): add sysctl OIDs for actual swap zone size and capacity
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/swap_pager.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index 54ebf9d..9af3085 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -164,6 +164,12 @@ static int overcommit = 0;
SYSCTL_INT(_vm, OID_AUTO, overcommit, CTLFLAG_RW, &overcommit, 0,
"Configure virtual memory overcommit behavior. See tuning(7) "
"for details.");
+static unsigned long swzone;
+SYSCTL_ULONG(_vm, OID_AUTO, swzone, CTLFLAG_RD, &swzone, 0,
+ "Actual size of swap metadata zone");
+static unsigned long swap_maxpages;
+SYSCTL_ULONG(_vm, OID_AUTO, swap_maxpages, CTLFLAG_RD, &swap_maxpages, 0,
+ "Maximum amount of swap supported");
/* bits from overcommit */
#define SWAP_RESERVE_FORCE_ON (1 << 0)
@@ -506,7 +512,7 @@ swap_pager_init(void)
void
swap_pager_swap_init(void)
{
- int n, n2;
+ unsigned long n, n2;
/*
* Number of in-transit swap bp operations. Don't
@@ -542,7 +548,7 @@ swap_pager_swap_init(void)
/*
* Initialize our zone. Right now I'm just guessing on the number
* we need based on the number of pages in the system. Each swblock
- * can hold 16 pages, so this is probably overkill. This reservation
+ * can hold 32 pages, so this is probably overkill. This reservation
* is typically limited to around 32MB by default.
*/
n = cnt.v_page_count / 2;
@@ -563,7 +569,9 @@ swap_pager_swap_init(void)
n -= ((n + 2) / 3);
} while (n > 0);
if (n2 != n)
- printf("Swap zone entries reduced from %d to %d.\n", n2, n);
+ printf("Swap zone entries reduced from %lu to %lu.\n", n2, n);
+ swap_maxpages = n * SWAP_META_PAGES;
+ swzone = n * sizeof(struct swblock);
n2 = n;
/*
OpenPOWER on IntegriCloud