Do not enable stack tracer for ZFS performance test

Linux ZFS test suite runs with /proc/sys/kernel/stack_tracer_enabled=1,
via zfs.sh script, which has negative performance impact, up to 40%.

Since large stack is a rare issue now, preferred behavior would be:
- making stack tracer an opt-in feature for zfs.sh
- zfs-test.sh enables stack tracer only when requested

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Tony Nguyen <tony.nguyen@delphix.com>
#8173
This commit is contained in:
Tony Nguyen 2018-12-07 11:51:42 -07:00 committed by Brian Behlendorf
parent d6496040d9
commit ef57371a92
2 changed files with 21 additions and 6 deletions

View File

@ -35,6 +35,7 @@ QUIET=
CLEANUP="yes" CLEANUP="yes"
CLEANUPALL="no" CLEANUPALL="no"
LOOPBACK="yes" LOOPBACK="yes"
STACK_TRACER="no"
FILESIZE="4G" FILESIZE="4G"
RUNFILE=${RUNFILE:-"linux.run"} RUNFILE=${RUNFILE:-"linux.run"}
FILEDIR=${FILEDIR:-/var/tmp} FILEDIR=${FILEDIR:-/var/tmp}
@ -254,7 +255,7 @@ constrain_path() {
usage() { usage() {
cat << EOF cat << EOF
USAGE: USAGE:
$0 [hvqxkf] [-s SIZE] [-r RUNFILE] [-t PATH] [-u USER] $0 [hvqxkfS] [-s SIZE] [-r RUNFILE] [-t PATH] [-u USER]
DESCRIPTION: DESCRIPTION:
ZFS Test Suite launch script ZFS Test Suite launch script
@ -266,6 +267,7 @@ OPTIONS:
-x Remove all testpools, dm, lo, and files (unsafe) -x Remove all testpools, dm, lo, and files (unsafe)
-k Disable cleanup after test failure -k Disable cleanup after test failure
-f Use files only, disables block device tests -f Use files only, disables block device tests
-S Enable stack tracer (negative performance impact)
-c Only create and populate constrained path -c Only create and populate constrained path
-I NUM Number of iterations -I NUM Number of iterations
-d DIR Use DIR for files and loopback devices -d DIR Use DIR for files and loopback devices
@ -289,7 +291,7 @@ $0 -x
EOF EOF
} }
while getopts 'hvqxkfcd:s:r:?t:T:u:I:' OPTION; do while getopts 'hvqxkfScd:s:r:?t:T:u:I:' OPTION; do
case $OPTION in case $OPTION in
h) h)
usage usage
@ -311,6 +313,9 @@ while getopts 'hvqxkfcd:s:r:?t:T:u:I:' OPTION; do
f) f)
LOOPBACK="no" LOOPBACK="no"
;; ;;
S)
STACK_TRACER="yes"
;;
c) c)
constrain_path constrain_path
exit exit
@ -449,7 +454,11 @@ constrain_path
# #
# Verify the ZFS module stack is loaded. # Verify the ZFS module stack is loaded.
# #
if [ "$STACK_TRACER" = "yes" ]; then
sudo "${ZFS_SH}" -S &>/dev/null
else
sudo "${ZFS_SH}" &>/dev/null sudo "${ZFS_SH}" &>/dev/null
fi
# #
# Attempt to cleanup all previous state for a new test run. # Attempt to cleanup all previous state for a new test run.
@ -561,6 +570,7 @@ msg "NUM_DISKS: $NUM_DISKS"
msg "FILESIZE: $FILESIZE" msg "FILESIZE: $FILESIZE"
msg "ITERATIONS: $ITERATIONS" msg "ITERATIONS: $ITERATIONS"
msg "TAGS: $TAGS" msg "TAGS: $TAGS"
msg "STACK_TRACER: $STACK_TRACER"
msg "Keep pool(s): $KEEP" msg "Keep pool(s): $KEEP"
msg "Missing util(s): $STF_MISSING_BIN" msg "Missing util(s): $STF_MISSING_BIN"
msg "" msg ""

View File

@ -14,6 +14,7 @@ fi
PROG=zfs.sh PROG=zfs.sh
VERBOSE="no" VERBOSE="no"
UNLOAD="no" UNLOAD="no"
STACK_TRACER="no"
ZED_PIDFILE=${ZED_PIDFILE:-/var/run/zed.pid} ZED_PIDFILE=${ZED_PIDFILE:-/var/run/zed.pid}
LDMOD=${LDMOD:-/sbin/modprobe} LDMOD=${LDMOD:-/sbin/modprobe}
@ -33,7 +34,7 @@ KMOD_ZFS=${KMOD_ZFS:-zfs}
usage() { usage() {
cat << EOF cat << EOF
USAGE: USAGE:
$0 [hvud] [module-options] $0 [hvudS] [module-options]
DESCRIPTION: DESCRIPTION:
Load/unload the ZFS module stack. Load/unload the ZFS module stack.
@ -42,10 +43,11 @@ OPTIONS:
-h Show this message -h Show this message
-v Verbose -v Verbose
-u Unload modules -u Unload modules
-S Enable kernel stack tracer
EOF EOF
} }
while getopts 'hvu' OPTION; do while getopts 'hvuS' OPTION; do
case $OPTION in case $OPTION in
h) h)
usage usage
@ -57,6 +59,9 @@ while getopts 'hvu' OPTION; do
u) u)
UNLOAD="yes" UNLOAD="yes"
;; ;;
S)
STACK_TRACER="yes"
;;
?) ?)
usage usage
exit exit
@ -192,7 +197,7 @@ stack_clear() {
STACK_MAX_SIZE=/sys/kernel/debug/tracing/stack_max_size STACK_MAX_SIZE=/sys/kernel/debug/tracing/stack_max_size
STACK_TRACER_ENABLED=/proc/sys/kernel/stack_tracer_enabled STACK_TRACER_ENABLED=/proc/sys/kernel/stack_tracer_enabled
if [ -e "$STACK_MAX_SIZE" ]; then if [ "$STACK_TRACER" = "yes" ] && [ -e "$STACK_MAX_SIZE" ]; then
echo 1 >"$STACK_TRACER_ENABLED" echo 1 >"$STACK_TRACER_ENABLED"
echo 0 >"$STACK_MAX_SIZE" echo 0 >"$STACK_MAX_SIZE"
fi fi