aboutsummaryrefslogtreecommitdiff
path: root/sys/cddl
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2017-05-26 11:05:56 +0000
committerAndriy Gapon <avg@FreeBSD.org>2017-05-26 11:05:56 +0000
commit8629ec8394eea8d5903055fa9d2f61f2f449dc6f (patch)
tree02fe7489566938c29b0a687c964f1329020b5e9e /sys/cddl
parentcf781c9b60c6843927283c89752bc4bb92ffdafa (diff)
Notes
Diffstat (limited to 'sys/cddl')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
index e821711a83e6..bbca2fd6b98d 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
@@ -6315,6 +6315,20 @@ arc_init(void)
{
int i, prefetch_tunable_set = 0;
+ /*
+ * allmem is "all memory that we could possibly use".
+ */
+#ifdef illumos
+#ifdef _KERNEL
+ uint64_t allmem = ptob(physmem - swapfs_minfree);
+#else
+ uint64_t allmem = (physmem * PAGESIZE) / 2;
+#endif
+#else
+ uint64_t allmem = kmem_size();
+#endif
+
+
mutex_init(&arc_reclaim_lock, NULL, MUTEX_DEFAULT, NULL);
cv_init(&arc_reclaim_thread_cv, NULL, CV_DEFAULT, NULL);
cv_init(&arc_reclaim_waiters_cv, NULL, CV_DEFAULT, NULL);
@@ -6326,7 +6340,7 @@ arc_init(void)
arc_min_prefetch_lifespan = 1 * hz;
/* Start out with 1/8 of all memory */
- arc_c = kmem_size() / 8;
+ arc_c = allmem / 8;
#ifdef illumos
#ifdef _KERNEL
@@ -6339,13 +6353,13 @@ arc_init(void)
#endif
#endif /* illumos */
/* set min cache to 1/32 of all memory, or arc_abs_min, whichever is more */
- arc_c_min = MAX(arc_c / 4, arc_abs_min);
- /* set max to 1/2 of all memory, or all but 1GB, whichever is more */
- if (arc_c * 8 >= 1 << 30)
- arc_c_max = (arc_c * 8) - (1 << 30);
+ arc_c_min = MAX(allmem / 32, arc_abs_min);
+ /* set max to 5/8 of all memory, or all but 1GB, whichever is more */
+ if (allmem >= 1 << 30)
+ arc_c_max = allmem - (1 << 30);
else
arc_c_max = arc_c_min;
- arc_c_max = MAX(arc_c * 5, arc_c_max);
+ arc_c_max = MAX(allmem * 5 / 8, arc_c_max);
/*
* In userland, there's only the memory pressure that we artificially
@@ -6362,7 +6376,7 @@ arc_init(void)
* Allow the tunables to override our calculations if they are
* reasonable.
*/
- if (zfs_arc_max > arc_abs_min && zfs_arc_max < kmem_size()) {
+ if (zfs_arc_max > arc_abs_min && zfs_arc_max < allmem) {
arc_c_max = zfs_arc_max;
arc_c_min = MIN(arc_c_min, arc_c_max);
}
@@ -6485,7 +6499,7 @@ arc_init(void)
printf("ZFS WARNING: Recommended minimum RAM size is 512MB; "
"expect unstable behavior.\n");
}
- if (kmem_size() < 512 * (1 << 20)) {
+ if (allmem < 512 * (1 << 20)) {
printf("ZFS WARNING: Recommended minimum kmem_size is 512MB; "
"expect unstable behavior.\n");
printf(" Consider tuning vm.kmem_size and "