aboutsummaryrefslogtreecommitdiff
path: root/tests/zfs-tests/tests/functional/arc/arcstats_runtime_tuning.ksh
blob: 6650b2e1a4d775a7beeccfd70ddd49684cf32101 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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 <ezomori.nozomu@gmail.com>. 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 ARC_MIN "$MINSIZE"
	log_must set_tunable64 ARC_MIN "$ZFS_ARC_MIN"
	log_must set_tunable64 ARC_MAX "$MAXSIZE"
	log_must set_tunable64 ARC_MAX "$ZFS_ARC_MAX"
}

log_onexit cleanup

ZFS_ARC_MAX="$(get_tunable ARC_MAX)"
ZFS_ARC_MIN="$(get_tunable 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 ARC_MAX "$size"
	log_must test "$(get_max_arc_size)" == "$size"
	log_must set_tunable64 ARC_MIN "$size"
	log_must test "$(get_min_arc_size)" == "$size"
done

log_pass "ARC tunables can be updated dynamically"