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 <tim@chase2k.com>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chris Dunlop <chris@onthe.net.au>
Closes #6269
This commit is contained in:
chrisrd 2017-06-30 02:57:27 +10:00 committed by Brian Behlendorf
parent 44f09cdc59
commit b8a97fb101
1 changed files with 23 additions and 17 deletions

View File

@ -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;
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_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;
/* 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)