1 Star 0 Fork 50

zhongling.h/systemd_1

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
10007-cgroup-update-only-siblings-that-got-realized-once.patch 2.23 KB
一键复制 编辑 原始数据 按行查看 历史
庞庆 提交于 2022-04-19 15:08 . Add optimized patches
From 841539281bed5187d2f773097eefb0bb3c5057ec Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 19 Apr 2022 14:03:12 +0800
Subject: [PATCH] cgroup: update only siblings that got realized once
---
src/core/cgroup.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index f02cc31..e0e0a98 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -1980,7 +1980,16 @@ static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) {
Unit *slice;
/* This adds the siblings of the specified unit and the siblings of all parent units to the cgroup
- * queue. (But neither the specified unit itself nor the parents.) */
+ * queue. (But neither the specified unit itself nor the parents.)
+ *
+ * Propagation of realization "side-ways" (i.e. towards siblings) is in relevant on cgroup-v1 where
+ * scheduling become very weird if two units that own processes reside in the same slice, but one is
+ * realized in the "cpu" hierarchy and once is not (for example because one has CPUWeight= set and
+ * the other does not), because that means processes need to be scheduled against groups. Let's avoid
+ * this asymmetry by always ensuring that units below a slice that are realized at all are hence
+ * always realized in *all* their hierarchies, and it is sufficient for a unit's sibling to be
+ * realized for a unit to be realized too. */
+
while ((slice = UNIT_DEREF(u->slice))) {
Iterator i;
@@ -1996,6 +2005,11 @@ static void unit_add_siblings_to_cgroup_realize_queue(Unit *u) {
if (UNIT_IS_INACTIVE_OR_FAILED(unit_active_state(m)))
continue;
+ /* We only enqueue siblings if they were realized once at least, in the main
+ * hierarchy. */
+ if (!m->cgroup_realized)
+ continue;
+
/* If the unit doesn't need any new controllers and has current ones realized, it
* doesn't need any changes. */
if (unit_has_mask_realized(m,
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhonglingh/systemd_1.git
git@gitee.com:zhonglingh/systemd_1.git
zhonglingh
systemd_1
systemd_1
a8

搜索帮助