Whamcloud - gitweb
LU-8522 tests: improve slabinfo accuracy when slub is used. 79/39579/3
authorMr NeilBrown <neilb@suse.de>
Thu, 6 Aug 2020 04:20:27 +0000 (14:20 +1000)
committerOleg Drokin <green@whamcloud.com>
Thu, 13 Aug 2020 06:04:48 +0000 (06:04 +0000)
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 <neilb@suse.de>
Change-Id: I36179d4609b5e4bcd1de00f0b5921c9c6bed72b0
Reviewed-on: https://review.whamcloud.com/39579
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/tests/sanity.sh

index b4d2cea..4b6a6f4 100755 (executable)
@@ -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"