~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/damon/sysfs_update_removed_scheme_dir.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0
  3 
  4 # Kselftest framework requirement - SKIP code is 4.
  5 ksft_skip=4
  6 
  7 if [ $EUID -ne 0 ]
  8 then
  9         echo "Run as root"
 10         exit $ksft_skip
 11 fi
 12 
 13 damon_sysfs="/sys/kernel/mm/damon/admin"
 14 if [ ! -d "$damon_sysfs" ]
 15 then
 16         echo "damon sysfs not found"
 17         exit $ksft_skip
 18 fi
 19 
 20 # clear log
 21 dmesg -C
 22 
 23 # start DAMON with a scheme
 24 echo 1 > "$damon_sysfs/kdamonds/nr_kdamonds"
 25 echo 1 > "$damon_sysfs/kdamonds/0/contexts/nr_contexts"
 26 echo "vaddr" > "$damon_sysfs/kdamonds/0/contexts/0/operations"
 27 echo 1 > "$damon_sysfs/kdamonds/0/contexts/0/targets/nr_targets"
 28 echo $$ > "$damon_sysfs/kdamonds/0/contexts/0/targets/0/pid_target"
 29 echo 1 > "$damon_sysfs/kdamonds/0/contexts/0/schemes/nr_schemes"
 30 scheme_dir="$damon_sysfs/kdamonds/0/contexts/0/schemes/0"
 31 echo 4096000 > "$scheme_dir/access_pattern/sz/max"
 32 echo 20 > "$scheme_dir/access_pattern/nr_accesses/max"
 33 echo 1024 > "$scheme_dir/access_pattern/age/max"
 34 echo "on" > "$damon_sysfs/kdamonds/0/state"
 35 sleep 0.3
 36 
 37 # remove scheme sysfs dir
 38 echo 0 > "$damon_sysfs/kdamonds/0/contexts/0/schemes/nr_schemes"
 39 
 40 # try to update stat of already removed scheme sysfs dir
 41 echo "update_schemes_stats" > "$damon_sysfs/kdamonds/0/state"
 42 if dmesg | grep -q BUG
 43 then
 44         echo "update_schemes_stats triggers a kernel bug"
 45         dmesg
 46         exit 1
 47 fi
 48 
 49 # try to update tried regions of already removed scheme sysfs dir
 50 echo "update_schemes_tried_regions" > "$damon_sysfs/kdamonds/0/state"
 51 if dmesg | grep -q BUG
 52 then
 53         echo "update_schemes_tried_regions triggers a kernel bug"
 54         dmesg
 55         exit 1
 56 fi
 57 
 58 echo "off" > "$damon_sysfs/kdamonds/0/state"

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php