Skip to content

Commit

Permalink
Do not enable stack tracer for ZFS performance test
Browse files Browse the repository at this point in the history
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

Signed-off-by: Tony Nguyen <tony.nguyen@delphix.com>
  • Loading branch information
tonynguien committed Dec 4, 2018
1 parent c40a112 commit a013ead
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
16 changes: 13 additions & 3 deletions scripts/zfs-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ QUIET=
CLEANUP="yes"
CLEANUPALL="no"
LOOPBACK="yes"
STACK_TRACER="no"
FILESIZE="4G"
RUNFILE=${RUNFILE:-"linux.run"}
FILEDIR=${FILEDIR:-/var/tmp}
Expand Down Expand Up @@ -254,7 +255,7 @@ constrain_path() {
usage() {
cat << EOF
USAGE:
$0 [hvqxkf] [-s SIZE] [-r RUNFILE] [-t PATH] [-u USER]
$0 [hvqxkfS] [-s SIZE] [-r RUNFILE] [-t PATH] [-u USER]
DESCRIPTION:
ZFS Test Suite launch script
Expand All @@ -266,6 +267,7 @@ OPTIONS:
-x Remove all testpools, dm, lo, and files (unsafe)
-k Disable cleanup after test failure
-f Use files only, disables block device tests
-S Enable stack tracer (negative performance impact)
-c Only create and populate constrained path
-I NUM Number of iterations
-d DIR Use DIR for files and loopback devices
Expand All @@ -289,7 +291,7 @@ $0 -x
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
h)
usage
Expand All @@ -311,6 +313,9 @@ while getopts 'hvqxkfcd:s:r:?t:T:u:I:' OPTION; do
f)
LOOPBACK="no"
;;
S)
STACK_TRACER="yes"
;;
c)
constrain_path
exit
Expand Down Expand Up @@ -449,7 +454,11 @@ constrain_path
#
# Verify the ZFS module stack is loaded.
#
sudo "${ZFS_SH}" &>/dev/null
if [ "$STACK_TRACER" = "yes" ]; then
sudo "${ZFS_SH}" -t &>/dev/null
else
sudo "${ZFS_SH}" &>/dev/null
fi

#
# Attempt to cleanup all previous state for a new test run.
Expand Down Expand Up @@ -561,6 +570,7 @@ msg "NUM_DISKS: $NUM_DISKS"
msg "FILESIZE: $FILESIZE"
msg "ITERATIONS: $ITERATIONS"
msg "TAGS: $TAGS"
msg "STACK_TRACER: $STACK_TRACER"
msg "Keep pool(s): $KEEP"
msg "Missing util(s): $STF_MISSING_BIN"
msg ""
Expand Down
9 changes: 7 additions & 2 deletions scripts/zfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ fi
PROG=zfs.sh
VERBOSE="no"
UNLOAD="no"
STACK_TRACER="no"

ZED_PIDFILE=${ZED_PIDFILE:-/var/run/zed.pid}
LDMOD=${LDMOD:-/sbin/modprobe}
Expand Down Expand Up @@ -42,10 +43,11 @@ OPTIONS:
-h Show this message
-v Verbose
-u Unload modules
-t Enable kernel stack tracer
EOF
}

while getopts 'hvu' OPTION; do
while getopts 'hvut' OPTION; do
case $OPTION in
h)
usage
Expand All @@ -57,6 +59,9 @@ while getopts 'hvu' OPTION; do
u)
UNLOAD="yes"
;;
t)
STACK_TRACER="yes"
;;
?)
usage
exit
Expand Down Expand Up @@ -192,7 +197,7 @@ stack_clear() {
STACK_MAX_SIZE=/sys/kernel/debug/tracing/stack_max_size
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 0 >"$STACK_MAX_SIZE"
fi
Expand Down

0 comments on commit a013ead

Please sign in to comment.