aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/arc.c
diff options
context:
space:
mode:
authorchrisrd <[email protected]>2017-06-30 02:57:27 +1000
committerBrian Behlendorf <[email protected]>2017-06-29 09:57:27 -0700
commitb8a97fb101555797400c3a275e67820c5d689802 (patch)
treeb181457d768497c77ee7d6865ed3dc056df87c3f /module/zfs/arc.c
parent44f09cdc59fd89f9bc935b4d36b7ed15d21ddeb3 (diff)
Set arc_meta_limit, arc_dnode_limit on change
Make zfs_arc_meta_limit_percent and zfs_arc_dnode_limit_percent behave as you would expect from zfs-module-parameters.5. - recalculate arc_meta_limit if zfs_arc_meta_limit_percent changes - recalculate arc_dnode_limit if zfs_arc_dnode_limit_percent changes - correctly set arc_meta_limit and arc_dnode_limit if zfs_arc_max or zfs_arc_meta_min changes Reviewed-by: Tim Chase <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Chris Dunlop <[email protected]> Closes #6269
Diffstat (limited to 'module/zfs/arc.c')
-rw-r--r--module/zfs/arc.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index 303db409b..e6b19f75c 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -6257,7 +6257,8 @@ arc_state_multilist_index_func(multilist_t *ml, void *obj)
static void
arc_tuning_update(void)
{
- uint64_t percent, allmem = arc_all_memory();
+ uint64_t allmem = arc_all_memory();
+ unsigned long limit;
/* Valid range: 64M - <all physical memory> */
if ((zfs_arc_max) && (zfs_arc_max != arc_c_max) &&
@@ -6266,11 +6267,10 @@ arc_tuning_update(void)
arc_c_max = zfs_arc_max;
arc_c = arc_c_max;
arc_p = (arc_c >> 1);
- /* Valid range of arc_meta_limit: arc_meta_min - arc_c_max */
- percent = MIN(zfs_arc_meta_limit_percent, 100);
- arc_meta_limit = MAX(arc_meta_min, (percent * arc_c_max) / 100);
- percent = MIN(zfs_arc_dnode_limit_percent, 100);
- arc_dnode_limit = (percent * arc_meta_limit) / 100;
+ if (arc_meta_limit > arc_c_max)
+ arc_meta_limit = arc_c_max;
+ if (arc_dnode_limit > arc_meta_limit)
+ arc_dnode_limit = arc_meta_limit;
}
/* Valid range: 32M - <arc_c_max> */
@@ -6286,21 +6286,27 @@ arc_tuning_update(void)
(zfs_arc_meta_min >= 1ULL << SPA_MAXBLOCKSHIFT) &&
(zfs_arc_meta_min <= arc_c_max)) {
arc_meta_min = zfs_arc_meta_min;
- arc_meta_limit = MAX(arc_meta_limit, arc_meta_min);
- arc_dnode_limit = arc_meta_limit / 10;
+ if (arc_meta_limit < arc_meta_min)
+ arc_meta_limit = arc_meta_min;
+ if (arc_dnode_limit < arc_meta_min)
+ arc_dnode_limit = arc_meta_min;
}
/* Valid range: <arc_meta_min> - <arc_c_max> */
- if ((zfs_arc_meta_limit) && (zfs_arc_meta_limit != arc_meta_limit) &&
- (zfs_arc_meta_limit >= zfs_arc_meta_min) &&
- (zfs_arc_meta_limit <= arc_c_max))
- arc_meta_limit = zfs_arc_meta_limit;
-
- /* Valid range: <arc_meta_min> - <arc_c_max> */
- if ((zfs_arc_dnode_limit) && (zfs_arc_dnode_limit != arc_dnode_limit) &&
- (zfs_arc_dnode_limit >= zfs_arc_meta_min) &&
- (zfs_arc_dnode_limit <= arc_c_max))
- arc_dnode_limit = zfs_arc_dnode_limit;
+ limit = zfs_arc_meta_limit ? zfs_arc_meta_limit :
+ MIN(zfs_arc_meta_limit_percent, 100) * arc_c_max / 100;
+ if ((limit != arc_meta_limit) &&
+ (limit >= arc_meta_min) &&
+ (limit <= arc_c_max))
+ arc_meta_limit = limit;
+
+ /* Valid range: <arc_meta_min> - <arc_meta_limit> */
+ limit = zfs_arc_dnode_limit ? zfs_arc_dnode_limit :
+ MIN(zfs_arc_dnode_limit_percent, 100) * arc_meta_limit / 100;
+ if ((limit != arc_dnode_limit) &&
+ (limit >= arc_meta_min) &&
+ (limit <= arc_meta_limit))
+ arc_dnode_limit = limit;
/* Valid range: 1 - N */
if (zfs_arc_grow_retry)