Skip to content
Permalink
Browse files

Don't ignore zfs_arc_max below allmem/32

Fixes #10157

Set arc_c_min before arc_c_max so that when zfs_arc_min is set lower
than the default allmem/32 zfs_arc_max can also be set lower.

Add warning messages when tunables are being ignored.

Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
  • Loading branch information
freqlabs committed Mar 26, 2020
1 parent ef3331e commit 4d61fc72f1666599bd12e11355b2b300bb974814
Showing with 21 additions and 9 deletions.
  1. +21 −9 module/zfs/arc.c
@@ -6900,6 +6900,12 @@ arc_state_multilist_index_func(multilist_t *ml, void *obj)
multilist_get_num_sublists(ml));
}

#define WARN_IF_TUN_IGNORED(tun, val) do { \
if ((tun) && ((tun) != (val))) \
dprintf("WARNING: ignoring tunable %s (using %llu instead)\n",\
(#tun), val); \
} while (0)

/*
* Called during module initialization and periodically thereafter to
* apply reasonable changes to the exposed performance tunings. Can also be
@@ -6913,6 +6919,15 @@ arc_tuning_update(void)
uint64_t allmem = arc_all_memory();
unsigned long limit;

/* Valid range: 32M - <arc_c_max> */
if ((zfs_arc_min) && (zfs_arc_min != arc_c_min) &&
(zfs_arc_min >= 2ULL << SPA_MAXBLOCKSHIFT) &&
(zfs_arc_min <= arc_c_max)) {
arc_c_min = zfs_arc_min;
arc_c = MAX(arc_c, arc_c_min);
}
WARN_IF_TUN_IGNORED(zfs_arc_min, arc_c_min);

/* Valid range: 64M - <all physical memory> */
if ((zfs_arc_max) && (zfs_arc_max != arc_c_max) &&
(zfs_arc_max >= 64 << 20) && (zfs_arc_max < allmem) &&
@@ -6925,14 +6940,7 @@ arc_tuning_update(void)
if (arc_dnode_size_limit > arc_meta_limit)
arc_dnode_size_limit = arc_meta_limit;
}

/* Valid range: 32M - <arc_c_max> */
if ((zfs_arc_min) && (zfs_arc_min != arc_c_min) &&
(zfs_arc_min >= 2ULL << SPA_MAXBLOCKSHIFT) &&
(zfs_arc_min <= arc_c_max)) {
arc_c_min = zfs_arc_min;
arc_c = MAX(arc_c, arc_c_min);
}
WARN_IF_TUN_IGNORED(zfs_arc_max, arc_c_max);

/* Valid range: 16M - <arc_c_max> */
if ((zfs_arc_meta_min) && (zfs_arc_meta_min != arc_meta_min) &&
@@ -6944,6 +6952,7 @@ arc_tuning_update(void)
if (arc_dnode_size_limit < arc_meta_min)
arc_dnode_size_limit = arc_meta_min;
}
WARN_IF_TUN_IGNORED(zfs_arc_meta_min, arc_meta_min);

/* Valid range: <arc_meta_min> - <arc_c_max> */
limit = zfs_arc_meta_limit ? zfs_arc_meta_limit :
@@ -6952,6 +6961,7 @@ arc_tuning_update(void)
(limit >= arc_meta_min) &&
(limit <= arc_c_max))
arc_meta_limit = limit;
WARN_IF_TUN_IGNORED(zfs_arc_meta_limit, arc_meta_limit);

/* Valid range: <arc_meta_min> - <arc_meta_limit> */
limit = zfs_arc_dnode_limit ? zfs_arc_dnode_limit :
@@ -6960,6 +6970,7 @@ arc_tuning_update(void)
(limit >= arc_meta_min) &&
(limit <= arc_meta_limit))
arc_dnode_size_limit = limit;
WARN_IF_TUN_IGNORED(zfs_arc_dnode_limit, arc_dnode_size_limit);

/* Valid range: 1 - N */
if (zfs_arc_grow_retry)
@@ -6989,11 +7000,12 @@ arc_tuning_update(void)
if ((zfs_arc_lotsfree_percent >= 0) &&
(zfs_arc_lotsfree_percent <= 100))
arc_lotsfree_percent = zfs_arc_lotsfree_percent;
WARN_IF_TUN_IGNORED(zfs_arc_lotsfree_percent, arc_lotsfree_percent);

/* Valid range: 0 - <all physical memory> */
if ((zfs_arc_sys_free) && (zfs_arc_sys_free != arc_sys_free))
arc_sys_free = MIN(MAX(zfs_arc_sys_free, 0), allmem);

WARN_IF_TUN_IGNORED(zfs_arc_sys_free, arc_sys_free);
}

static void

0 comments on commit 4d61fc7

Please sign in to comment.
You can’t perform that action at this time.