Commit 877c737d authored by Waiman Long's avatar Waiman Long Committed by Tejun Heo

cgroup/cpuset: Expose cpuset.cpus.isolated

The root-only cpuset.cpus.isolated control file shows the current set
of isolated CPUs in isolated partitions. This control file is currently
exposed only with the cgroup_debug boot command line option which also
adds the ".__DEBUG__." prefix. This is actually a useful control file if
users want to find out which CPUs are currently in an isolated state by
the cpuset controller. Remove CFTYPE_DEBUG flag for this control file and
make it available by default without any prefix.

The test_cpuset_prs.sh test script and the cgroup-v2.rst documentation
file are also updated accordingly. Minor code change is also made in
test_cpuset_prs.sh to avoid false test failure when running on debug
kernel.
Signed-off-by: default avatarWaiman Long <longman@redhat.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 20259566
...@@ -2316,6 +2316,13 @@ Cpuset Interface Files ...@@ -2316,6 +2316,13 @@ Cpuset Interface Files
treated to have an implicit value of "cpuset.cpus" in the treated to have an implicit value of "cpuset.cpus" in the
formation of local partition. formation of local partition.
cpuset.cpus.isolated
A read-only and root cgroup only multiple values file.
This file shows the set of all isolated CPUs used in existing
isolated partitions. It will be empty if no isolated partition
is created.
cpuset.cpus.partition cpuset.cpus.partition
A read-write single value file which exists on non-root A read-write single value file which exists on non-root
cpuset-enabled cgroups. This flag is owned by the parent cgroup cpuset-enabled cgroups. This flag is owned by the parent cgroup
......
...@@ -3974,7 +3974,7 @@ static struct cftype dfl_files[] = { ...@@ -3974,7 +3974,7 @@ static struct cftype dfl_files[] = {
.name = "cpus.isolated", .name = "cpus.isolated",
.seq_show = cpuset_common_seq_show, .seq_show = cpuset_common_seq_show,
.private = FILE_ISOLATED_CPULIST, .private = FILE_ISOLATED_CPULIST,
.flags = CFTYPE_ONLY_ON_ROOT | CFTYPE_DEBUG, .flags = CFTYPE_ONLY_ON_ROOT,
}, },
{ } /* terminate */ { } /* terminate */
......
...@@ -508,7 +508,7 @@ dump_states() ...@@ -508,7 +508,7 @@ dump_states()
XECPUS=$DIR/cpuset.cpus.exclusive.effective XECPUS=$DIR/cpuset.cpus.exclusive.effective
PRS=$DIR/cpuset.cpus.partition PRS=$DIR/cpuset.cpus.partition
PCPUS=$DIR/.__DEBUG__.cpuset.cpus.subpartitions PCPUS=$DIR/.__DEBUG__.cpuset.cpus.subpartitions
ISCPUS=$DIR/.__DEBUG__.cpuset.cpus.isolated ISCPUS=$DIR/cpuset.cpus.isolated
[[ -e $CPUS ]] && echo "$CPUS: $(cat $CPUS)" [[ -e $CPUS ]] && echo "$CPUS: $(cat $CPUS)"
[[ -e $XCPUS ]] && echo "$XCPUS: $(cat $XCPUS)" [[ -e $XCPUS ]] && echo "$XCPUS: $(cat $XCPUS)"
[[ -e $ECPUS ]] && echo "$ECPUS: $(cat $ECPUS)" [[ -e $ECPUS ]] && echo "$ECPUS: $(cat $ECPUS)"
...@@ -593,17 +593,17 @@ check_cgroup_states() ...@@ -593,17 +593,17 @@ check_cgroup_states()
# #
# Get isolated (including offline) CPUs by looking at # Get isolated (including offline) CPUs by looking at
# /sys/kernel/debug/sched/domains and *cpuset.cpus.isolated control file, # /sys/kernel/debug/sched/domains and cpuset.cpus.isolated control file,
# if available, and compare that with the expected value. # if available, and compare that with the expected value.
# #
# Note that isolated CPUs from the sched/domains context include offline # Note that isolated CPUs from the sched/domains context include offline
# CPUs as well as CPUs in non-isolated 1-CPU partition. Those CPUs may # CPUs as well as CPUs in non-isolated 1-CPU partition. Those CPUs may
# not be included in the *cpuset.cpus.isolated control file which contains # not be included in the cpuset.cpus.isolated control file which contains
# only CPUs in isolated partitions. # only CPUs in isolated partitions.
# #
# $1 - expected isolated cpu list(s) <isolcpus1>{,<isolcpus2>} # $1 - expected isolated cpu list(s) <isolcpus1>{,<isolcpus2>}
# <isolcpus1> - expected sched/domains value # <isolcpus1> - expected sched/domains value
# <isolcpus2> - *cpuset.cpus.isolated value = <isolcpus1> if not defined # <isolcpus2> - cpuset.cpus.isolated value = <isolcpus1> if not defined
# #
check_isolcpus() check_isolcpus()
{ {
...@@ -611,7 +611,7 @@ check_isolcpus() ...@@ -611,7 +611,7 @@ check_isolcpus()
ISOLCPUS= ISOLCPUS=
LASTISOLCPU= LASTISOLCPU=
SCHED_DOMAINS=/sys/kernel/debug/sched/domains SCHED_DOMAINS=/sys/kernel/debug/sched/domains
ISCPUS=${CGROUP2}/.__DEBUG__.cpuset.cpus.isolated ISCPUS=${CGROUP2}/cpuset.cpus.isolated
if [[ $EXPECT_VAL = . ]] if [[ $EXPECT_VAL = . ]]
then then
EXPECT_VAL= EXPECT_VAL=
...@@ -692,14 +692,18 @@ test_fail() ...@@ -692,14 +692,18 @@ test_fail()
null_isolcpus_check() null_isolcpus_check()
{ {
[[ $VERBOSE -gt 0 ]] || return 0 [[ $VERBOSE -gt 0 ]] || return 0
pause 0.02 # Retry a few times before printing error
check_isolcpus "." RETRY=0
if [[ $? -ne 0 ]] while [[ $RETRY -lt 5 ]]
then do
echo "Unexpected isolated CPUs: $ISOLCPUS" pause 0.01
dump_states check_isolcpus "."
exit 1 [[ $? -eq 0 ]] && return 0
fi ((RETRY++))
done
echo "Unexpected isolated CPUs: $ISOLCPUS"
dump_states
exit 1
} }
# #
...@@ -776,7 +780,7 @@ run_state_test() ...@@ -776,7 +780,7 @@ run_state_test()
# #
NEWLIST=$(cat cpuset.cpus.effective) NEWLIST=$(cat cpuset.cpus.effective)
RETRY=0 RETRY=0
while [[ $NEWLIST != $CPULIST && $RETRY -lt 5 ]] while [[ $NEWLIST != $CPULIST && $RETRY -lt 8 ]]
do do
# Wait a bit longer & recheck a few times # Wait a bit longer & recheck a few times
pause 0.01 pause 0.01
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment