diff options
author | loli10K <[email protected]> | 2019-10-27 00:22:19 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-10-26 15:22:19 -0700 |
commit | e35704647e84c62c6a6017ead0b66b446010e4ff (patch) | |
tree | da45b7d329f00cf2aaa2b6e0420a933e1d6784fd /tests | |
parent | 6963414d7049b52047982fd94bfc16522bc5c26c (diff) |
Fix for ARC sysctls ignored at runtime
This change leverage module_param_call() to run arc_tuning_update()
immediately after the ARC tunable has been updated as suggested in
cffa8372 code review.
A simple test case is added to the ZFS Test Suite to prevent future
regressions in functionality.
Reviewed-by: Matt Macy <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: loli10K <[email protected]>
Closes #9487
Closes #9489
Diffstat (limited to 'tests')
-rw-r--r-- | tests/runfiles/linux.run | 3 | ||||
-rw-r--r-- | tests/zfs-tests/tests/functional/arc/Makefile.am | 1 | ||||
-rwxr-xr-x | tests/zfs-tests/tests/functional/arc/arcstats_runtime_tuning.ksh | 46 | ||||
-rw-r--r-- | tests/zfs-tests/tests/perf/perf.shlib | 17 |
4 files changed, 66 insertions, 1 deletions
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run index 777588ac4..a134c8db8 100644 --- a/tests/runfiles/linux.run +++ b/tests/runfiles/linux.run @@ -25,7 +25,8 @@ tests = ['posix_001_pos', 'posix_002_pos', 'posix_003_pos'] tags = ['functional', 'acl', 'posix'] [tests/functional/arc:Linux] -tests = ['dbufstats_001_pos', 'dbufstats_002_pos', 'dbufstats_003_pos'] +tests = ['dbufstats_001_pos', 'dbufstats_002_pos', 'dbufstats_003_pos', + 'arcstats_runtime_tuning'] tags = ['functional', 'arc'] [tests/functional/atime:Linux] diff --git a/tests/zfs-tests/tests/functional/arc/Makefile.am b/tests/zfs-tests/tests/functional/arc/Makefile.am index 22704fa51..809d0346f 100644 --- a/tests/zfs-tests/tests/functional/arc/Makefile.am +++ b/tests/zfs-tests/tests/functional/arc/Makefile.am @@ -2,6 +2,7 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/arc dist_pkgdata_SCRIPTS = \ cleanup.ksh \ setup.ksh \ + arcstats_runtime_tuning.ksh \ dbufstats_001_pos.ksh \ dbufstats_002_pos.ksh \ dbufstats_003_pos.ksh diff --git a/tests/zfs-tests/tests/functional/arc/arcstats_runtime_tuning.ksh b/tests/zfs-tests/tests/functional/arc/arcstats_runtime_tuning.ksh new file mode 100755 index 000000000..6d007aecf --- /dev/null +++ b/tests/zfs-tests/tests/functional/arc/arcstats_runtime_tuning.ksh @@ -0,0 +1,46 @@ +#!/bin/ksh -p +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2019, loli10K <[email protected]>. All rights reserved. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/perf/perf.shlib + +function cleanup +{ + # Set tunables to their recorded actual size and then to their original + # value: this works for previously unconfigured tunables. + log_must set_tunable64 zfs_arc_min "$MINSIZE" + log_must set_tunable64 zfs_arc_min "$ZFS_ARC_MIN" + log_must set_tunable64 zfs_arc_max "$MAXSIZE" + log_must set_tunable64 zfs_arc_max "$ZFS_ARC_MAX" +} + +log_onexit cleanup + +ZFS_ARC_MAX="$(get_tunable zfs_arc_max)" +ZFS_ARC_MIN="$(get_tunable zfs_arc_min)" +MINSIZE="$(get_min_arc_size)" +MAXSIZE="$(get_max_arc_size)" + +log_assert "ARC tunables should be updated dynamically" + +for size in $((MAXSIZE/4)) $((MAXSIZE/3)) $((MAXSIZE/2)) $MAXSIZE; do + log_must set_tunable64 zfs_arc_max "$size" + log_must test "$(get_max_arc_size)" == "$size" + log_must set_tunable64 zfs_arc_min "$size" + log_must test "$(get_min_arc_size)" == "$size" +done + +log_pass "ARC tunables can be updated dynamically" diff --git a/tests/zfs-tests/tests/perf/perf.shlib b/tests/zfs-tests/tests/perf/perf.shlib index 69e61e9fd..e2e84ca02 100644 --- a/tests/zfs-tests/tests/perf/perf.shlib +++ b/tests/zfs-tests/tests/perf/perf.shlib @@ -373,6 +373,23 @@ function get_directory echo $directory } +function get_min_arc_size +{ + if is_linux; then + typeset -l min_arc_size=`awk '$1 == "c_min" { print $3 }' \ + /proc/spl/kstat/zfs/arcstats` + else + typeset -l min_arc_size=$(dtrace -qn 'BEGIN { + printf("%u\n", `arc_stats.arcstat_c_min.value.ui64); + exit(0); + }') + fi + + [[ $? -eq 0 ]] || log_fail "get_min_arc_size failed" + + echo $min_arc_size +} + function get_max_arc_size { if is_linux; then |