[root@localhost ~]# cat /usr/bin/cgroup_swappiness_set.sh #!/bin/sh CGROUP_V1_MEMORY_DIR=$(mount | grep "^cgroup .*memory" | cut -d ' ' -f 3) if [ -z $CGROUP_V1_MEMORY_DIR ]; then exit -22 # EINVAL fi GLOBAL_SWAPPINESS=$(cat /proc/sys/vm/swappiness) for cg in $(find $CGROUP_V1_MEMORY_DIR -name memory.swappiness); do echo $GLOBAL_SWAPPINESS > $cg done [root@localhost ~]# chmod +x /usr/bin/cgroup_swappiness_set.sh