1 Star 0 Fork 18

苏峰/tuned

forked from src-anolis-os/tuned 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
tuned-2.18.0-sd-load-balance.patch 2.54 KB
一键复制 编辑 原始数据 按行查看 历史
geliwei 提交于 2022-04-13 15:45 . update to tuned-2.18.0-2.el8.src.rpm
diff --git a/profiles/cpu-partitioning/script.sh b/profiles/cpu-partitioning/script.sh
index 84e04fd..8677050 100755
--- a/profiles/cpu-partitioning/script.sh
+++ b/profiles/cpu-partitioning/script.sh
@@ -2,6 +2,38 @@
. /usr/lib/tuned/functions
+no_balance_cpus_file=$STORAGE/no-balance-cpus.txt
+
+change_sd_balance_bit()
+{
+ local set_bit=$1
+ local flags_cur=
+ local file=
+ local cpu=
+
+ for cpu in $(cat $no_balance_cpus_file); do
+ for file in $(find /proc/sys/kernel/sched_domain/cpu$cpu -name flags -print); do
+ flags_cur=$(cat $file)
+ if [ $set_bit -eq 1 ]; then
+ flags_cur=$((flags_cur | 0x1))
+ else
+ flags_cur=$((flags_cur & 0xfffe))
+ fi
+ echo $flags_cur > $file
+ done
+ done
+}
+
+disable_balance_domains()
+{
+ change_sd_balance_bit 0
+}
+
+enable_balance_domains()
+{
+ change_sd_balance_bit 1
+}
+
start() {
mkdir -p "${TUNED_tmpdir}/etc/systemd"
mkdir -p "${TUNED_tmpdir}/usr/lib/dracut/hooks/pre-udev"
@@ -9,6 +41,9 @@ start() {
cp 00-tuned-pre-udev.sh "${TUNED_tmpdir}/usr/lib/dracut/hooks/pre-udev/"
setup_kvm_mod_low_latency
disable_ksm
+
+ echo "$TUNED_no_balance_cores_expanded" | sed 's/,/ /g' > $no_balance_cpus_file
+ disable_balance_domains
return "$?"
}
@@ -18,6 +53,7 @@ stop() {
teardown_kvm_mod_low_latency
enable_ksm
fi
+ enable_balance_domains
return "$?"
}
diff --git a/profiles/cpu-partitioning/tuned.conf b/profiles/cpu-partitioning/tuned.conf
index 979e40b..842e2bd 100644
--- a/profiles/cpu-partitioning/tuned.conf
+++ b/profiles/cpu-partitioning/tuned.conf
@@ -35,8 +35,6 @@ no_balance_cores_expanded=${f:cpulist_unpack:${no_balance_cores}}
# Fail if isolated_cores contains CPUs which are not online
assert2=${f:assertion:isolated_cores contains online CPU(s):${isolated_cores_expanded}:${isolated_cores_online_expanded}}
-cmd_isolcpus=${f:regex_search_ternary:${no_balance_cores}:\s*[0-9]: isolcpus=${no_balance_cores}:}
-
[sysctl]
kernel.hung_task_timeout_secs = 600
kernel.nmi_watchdog = 0
@@ -68,4 +66,4 @@ priority=10
initrd_remove_dir=True
initrd_dst_img=tuned-initrd.img
initrd_add_dir=${tmpdir}
-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
+cmdline_cpu_part=+nohz=on nohz_full=${isolated_cores} rcu_nocbs=${isolated_cores} tuned.non_isolcpus=${not_isolated_cpumask} intel_pstate=disable nosoftlockup
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/su-feng-nmg/tuned.git
git@gitee.com:su-feng-nmg/tuned.git
su-feng-nmg
tuned
tuned
a8

搜索帮助