1 Star 0 Fork 48

Zhao Hang/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0370-pid1-add-new-kernel-cmdline-arg-systemd.cpu_affinity.patch 2.37 KB
一键复制 编辑 原始数据 按行查看 历史
geliwei 提交于 2021-06-16 16:46 . update to systemd-239-45.el8.src.rpm
From 82156850f6642a363aa2ff06677ad089a460104e Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 26 Nov 2019 09:46:00 +0100
Subject: [PATCH] pid1: add new kernel cmdline arg systemd.cpu_affinity=
Let's allow configuration of the CPU affinity via the kernel cmdline,
overriding CPUAffinity= in /etc/systemd/system.conf
Prompted by:
https://lists.freedesktop.org/archives/systemd-devel/2019-November/043754.html
(cherry picked from commit 68d58f38693e586b5ce5785274f8e42a79625196)
Resolves: #1812894
---
man/kernel-command-line.xml | 11 +++++++++++
src/core/main.c | 9 +++++++++
2 files changed, 20 insertions(+)
diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml
index 0545f9d84b..4d8cb4e50e 100644
--- a/man/kernel-command-line.xml
+++ b/man/kernel-command-line.xml
@@ -366,6 +366,17 @@
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>systemd.cpu_affinity=</varname></term>
+
+ <listitem>
+ <para>Overrides the CPU affinity mask for the service manager and the default for all child
+ processes it forks. This takes precedence over <varname>CPUAffinity=</varname>, see
+ <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+ for details.</para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><varname>modules_load=</varname></term>
<term><varname>rd.modules_load=</varname></term>
diff --git a/src/core/main.c b/src/core/main.c
index 45d09b1e11..9f238a8430 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -472,6 +472,15 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
if (arg_default_timeout_start_usec <= 0)
arg_default_timeout_start_usec = USEC_INFINITY;
+ } else if (proc_cmdline_key_streq(key, "systemd.cpu_affinity")) {
+
+ if (proc_cmdline_value_missing(key, value))
+ return 0;
+
+ r = parse_cpu_set(value, &arg_cpu_affinity);
+ if (r < 0)
+ log_warning_errno(r, "Failed to parse CPU affinity mask '%s', ignoring: %m", value);
+
} else if (proc_cmdline_key_streq(key, "systemd.watchdog_device")) {
if (proc_cmdline_value_missing(key, value))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhaohang_mskdxl/systemd.git
git@gitee.com:zhaohang_mskdxl/systemd.git
zhaohang_mskdxl
systemd
systemd
a8

搜索帮助