summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/damon/debugfs_target_ids_pid_leak.sh
blob: 31fe33c2b032568db139c8e8021cea2a678eb095 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

before=$(grep "^pid " /proc/slabinfo | awk '{print $2}')

nr_leaks=$(./debugfs_target_ids_pid_leak 1000)
expected_after_max=$((before + nr_leaks / 2))

after=$(grep "^pid " /proc/slabinfo | awk '{print $2}')

echo > /sys/kernel/debug/damon/target_ids

echo "tried $nr_leaks pid leak"
echo "number of active pid slabs: $before -> $after"
echo "(up to $expected_after_max expected)"
if [ $after -gt $expected_after_max ]
then
	echo "maybe pids are leaking"
	exit 1
else
	exit 0
fi