Path: blob/master/tools/testing/selftests/damon/reclaim.sh
29268 views
#!/bin/bash1# SPDX-License-Identifier: GPL-2.023source _common.sh45# Kselftest framework requirement - SKIP code is 4.6ksft_skip=478check_dependencies910damon_reclaim_enabled="/sys/module/damon_reclaim/parameters/enabled"11if [ ! -f "$damon_reclaim_enabled" ]12then13echo "No 'enabled' file. Maybe DAMON_RECLAIM not built"14exit $ksft_skip15fi1617nr_kdamonds=$(pgrep kdamond | wc -l)18if [ "$nr_kdamonds" -ne 0 ]19then20echo "Another kdamond is running"21exit $ksft_skip22fi2324echo Y > "$damon_reclaim_enabled"2526nr_kdamonds=$(pgrep kdamond | wc -l)27if [ "$nr_kdamonds" -ne 1 ]28then29echo "kdamond is not turned on"30exit 131fi3233echo N > "$damon_reclaim_enabled"34nr_kdamonds=$(pgrep kdamond | wc -l)35if [ "$nr_kdamonds" -ne 0 ]36then37echo "kdamond is not turned off"38exit 139fi404142