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

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