From a6b5441de4269ee634a83fc717d3c28380c0fcfd Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Thu, 6 Aug 2020 14:20:27 +1000 Subject: [PATCH] LU-8522 tests: improve slabinfo accuracy when slub is used. The "active_objs" count in slabinfo is never very accurate, but when CONFIG_SLUB is being used it is even less accurate than with CONFIG_SLAB. If CONFIG_SLUB_DEBUG is also enabled, it is possible to shrink the cache and remove this inaccuracy by writing '1' to /sys/kernel/slab/$CACHENAME/shrink So add appropriate code to sanity.sh so that when the 'shrink' file is available, it is used. Test-Parameters: trivial Signed-off-by: Mr NeilBrown Change-Id: I36179d4609b5e4bcd1de00f0b5921c9c6bed72b0 Reviewed-on: https://review.whamcloud.com/39579 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Andreas Dilger --- lustre/tests/sanity.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index b4d2cea..4b6a6f4 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -8601,6 +8601,8 @@ test_74c() { run_test 74c "ldlm_lock_create error path, (shouldn't LBUG)" num_inodes() { + [ -f /sys/kernel/slab/lustre_inode_cache/shrink ] && + echo 1 > /sys/kernel/slab/lustre_inode_cache/shrink awk '/lustre_inode_cache/ {print $2; exit}' /proc/slabinfo } @@ -16608,6 +16610,8 @@ test_209() { sync; sleep 5; sync; echo 3 > /proc/sys/vm/drop_caches + [ -f /sys/kernel/slab/ptlrpc_cache/shrink ] && + echo 1 > /sys/kernel/slab/ptlrpc_cache/shrink req_before=$(awk '/ptlrpc_cache / { print $2 }' /proc/slabinfo) # open/close 500 times @@ -16616,6 +16620,8 @@ test_209() { done echo 3 > /proc/sys/vm/drop_caches + [ -f /sys/kernel/slab/ptlrpc_cache/shrink ] && + echo 1 > /sys/kernel/slab/ptlrpc_cache/shrink req_after=$(awk '/ptlrpc_cache / { print $2 }' /proc/slabinfo) echo "before: $req_before, after: $req_after" -- 1.8.3.1