diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2014-06-30 15:50:02 +0530 |
---|---|---|
committer | Viresh Kumar <viresh.kumar@linaro.org> | 2014-07-02 15:33:05 +0530 |
commit | f7c5a9c384dd4819a27f2042d6ad2a59d7db28e2 (patch) | |
tree | 29edd97c04a4a7a5d6cd2732d66c4951c03cd6e9 /common | |
parent | f1e23b1b03d94ec0da684f98c399ce20a4d694c6 (diff) |
is-cpu-isolated: create per-cpu cpuset directories
So that we can isolate all CPUs.
Change-Id: I8c1baef9fe23950cc8752e7df3628af8c5d8e3bb
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'common')
-rwxr-xr-x | common/scripts/is-cpu-isolated.sh | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/common/scripts/is-cpu-isolated.sh b/common/scripts/is-cpu-isolated.sh index 51610b9..8bfb6f9 100755 --- a/common/scripts/is-cpu-isolated.sh +++ b/common/scripts/is-cpu-isolated.sh @@ -109,6 +109,30 @@ total_interrupts() { ' /proc/interrupts } +# Create per-cpu data plane cpuset +create_dplane_cpuset() { + # Create per-cpu cpuset and set important fields + [ -d /dev/cpuset/dplane/cpu$1 ] || mkdir /dev/cpuset/dplane/cpu$1 + + echo 0 > /dev/cpuset/dplane/cpu$1/$CPUSET_PREFIX"mems" + echo $1 > /dev/cpuset/dplane/cpu$1/$CPUSET_PREFIX"cpus" + echo 0 > /dev/cpuset/dplane/cpu$1/$CPUSET_PREFIX"sched_load_balance" + + # Move shell to isolated CPU + echo $$ > /dev/cpuset/dplane/cpu$1/tasks + + # Start single cpu bound stress thread + stress -q --cpu 1 --timeout $STRESS_DURATION & + + # Move shell back to control plane CPU + echo $$ > /dev/cpuset/cplane/tasks +} + +# Remove per-cpu cpusets +remove_dplane_cpuset() { + rmdir /dev/cpuset/dplane/cpu$1 +} + # Update sysfs tunables to isolate CPU update_sysfs_tunables() { # Call cpufreq_fix_governor for each isolated CPU @@ -216,14 +240,8 @@ isolate_cpu() { #echo 0 > /sys/devices/system/cpu/cpu$ISOL_CPU/online #echo 1 > /sys/devices/system/cpu/cpu$ISOL_CPU/online - # Move shell to isolated CPU - echo $$ > /dev/cpuset/dplane/tasks - - # Start single cpu bound stress thread - stress -q --cpu 1 --timeout $STRESS_DURATION & - - # Move shell back to control plane CPU - echo $$ > /dev/cpuset/cplane/tasks + # Call create_dplane_cpuset for each isolated CPU + for_each_isol_cpu create_dplane_cpuset } # routine to get CPU isolation time @@ -358,6 +376,7 @@ clear_cpusets() { done # Remove the CPUsets + for_each_isol_cpu remove_dplane_cpuset rmdir /dev/cpuset/cplane rmdir /dev/cpuset/dplane } |