Blame SOURCES/tuned-2.18.0-sd-load-balance.patch

2e2415
diff --git a/profiles/cpu-partitioning/script.sh b/profiles/cpu-partitioning/script.sh
2e2415
index 84e04fd..8677050 100755
2e2415
--- a/profiles/cpu-partitioning/script.sh
2e2415
+++ b/profiles/cpu-partitioning/script.sh
2e2415
@@ -2,6 +2,38 @@
2e2415
 
2e2415
 . /usr/lib/tuned/functions
2e2415
 
2e2415
+no_balance_cpus_file=$STORAGE/no-balance-cpus.txt
2e2415
+
2e2415
+change_sd_balance_bit()
2e2415
+{
2e2415
+    local set_bit=$1
2e2415
+    local flags_cur=
2e2415
+    local file=
2e2415
+    local cpu=
2e2415
+
2e2415
+    for cpu in $(cat $no_balance_cpus_file); do
2e2415
+        for file in $(find /proc/sys/kernel/sched_domain/cpu$cpu -name flags -print); do
2e2415
+            flags_cur=$(cat $file)
2e2415
+            if [ $set_bit -eq 1 ]; then
2e2415
+                flags_cur=$((flags_cur | 0x1))
2e2415
+            else
2e2415
+                flags_cur=$((flags_cur & 0xfffe))
2e2415
+            fi
2e2415
+            echo $flags_cur > $file
2e2415
+        done
2e2415
+    done
2e2415
+}
2e2415
+
2e2415
+disable_balance_domains()
2e2415
+{
2e2415
+    change_sd_balance_bit 0
2e2415
+}
2e2415
+
2e2415
+enable_balance_domains()
2e2415
+{
2e2415
+    change_sd_balance_bit 1
2e2415
+}
2e2415
+
2e2415
 start() {
2e2415
     mkdir -p "${TUNED_tmpdir}/etc/systemd"
2e2415
     mkdir -p "${TUNED_tmpdir}/usr/lib/dracut/hooks/pre-udev"
2e2415
@@ -9,6 +41,9 @@ start() {
2e2415
     cp 00-tuned-pre-udev.sh "${TUNED_tmpdir}/usr/lib/dracut/hooks/pre-udev/"
2e2415
     setup_kvm_mod_low_latency
2e2415
     disable_ksm
2e2415
+
2e2415
+    echo "$TUNED_no_balance_cores_expanded" | sed 's/,/ /g' > $no_balance_cpus_file
2e2415
+    disable_balance_domains
2e2415
     return "$?"
2e2415
 }
2e2415
 
2e2415
@@ -18,6 +53,7 @@ stop() {
2e2415
         teardown_kvm_mod_low_latency
2e2415
         enable_ksm
2e2415
     fi
2e2415
+    enable_balance_domains
2e2415
     return "$?"
2e2415
 }
2e2415
 
2e2415
diff --git a/profiles/cpu-partitioning/tuned.conf b/profiles/cpu-partitioning/tuned.conf
2e2415
index 979e40b..842e2bd 100644
2e2415
--- a/profiles/cpu-partitioning/tuned.conf
2e2415
+++ b/profiles/cpu-partitioning/tuned.conf
2e2415
@@ -35,8 +35,6 @@ no_balance_cores_expanded=${f:cpulist_unpack:${no_balance_cores}}
2e2415
 # Fail if isolated_cores contains CPUs which are not online
2e2415
 assert2=${f:assertion:isolated_cores contains online CPU(s):${isolated_cores_expanded}:${isolated_cores_online_expanded}}
2e2415
 
2e2415
-cmd_isolcpus=${f:regex_search_ternary:${no_balance_cores}:\s*[0-9]: isolcpus=${no_balance_cores}:}
2e2415
-
2e2415
 [sysctl]
2e2415
 kernel.hung_task_timeout_secs = 600
2e2415
 kernel.nmi_watchdog = 0
2e2415
@@ -68,4 +66,4 @@ priority=10
2e2415
 initrd_remove_dir=True
2e2415
 initrd_dst_img=tuned-initrd.img
2e2415
 initrd_add_dir=${tmpdir}
2e2415
-cmdline_cpu_part=+nohz=on${cmd_isolcpus} nohz_full=${isolated_cores} rcu_nocbs=${isolated_cores} tuned.non_isolcpus=${not_isolated_cpumask} intel_pstate=disable nosoftlockup
2e2415
+cmdline_cpu_part=+nohz=on nohz_full=${isolated_cores} rcu_nocbs=${isolated_cores} tuned.non_isolcpus=${not_isolated_cpumask} intel_pstate=disable nosoftlockup