selftests/damon: add a test for a race between target_ids_read() and dbgfs_before_ter...
authorSeongJae Park <sj@kernel.org>
Wed, 7 Feb 2024 20:31:32 +0000 (12:31 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 22 Feb 2024 18:24:56 +0000 (10:24 -0800)
commite6255a297628ddd7ead9cf8fb2ce11168595c89d
tree5450697d2e1612c82dc22189cf294e1b00b70559
parentce7a2834659fd18eda042574696fe4191f069e31
selftests/damon: add a test for a race between target_ids_read() and dbgfs_before_terminate()

commit 34796417964b ("mm/damon/dbgfs: protect targets destructions with
kdamond_lock") fixed a race of DAMON debugfs interface.  Specifically, the
race was happening between target_ids_read() and dbgfs_before_terminate().
Add a test for the issue to prevent the problem from accidentally
recurring.

Link: https://lkml.kernel.org/r/20240207203134.69976-7-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/damon/.gitignore
tools/testing/selftests/damon/Makefile
tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.c [new file with mode: 0644]
tools/testing/selftests/damon/debugfs_target_ids_read_before_terminate_race.sh [new file with mode: 0644]