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

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