代码拉取完成,页面将自动刷新
同步操作将从 src-anolis-os/systemd 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From f21d63650318791f29f56dc26f23acb5b53620a6 Mon Sep 17 00:00:00 2001
From:Yuanhong Peng <yummypeng@linux.alibaba.com>
Date: Tue, 19 Apr 2022 14:13:49 +0800
Subject: [PATCH] core: add a config item to support setting the value
---
src/core/main.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/src/core/main.c b/src/core/main.c
index 81dae1c..0712423 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -140,6 +140,7 @@ static NUMAPolicy arg_numa_policy;
static bool reexec_jmp_can = false;
static bool reexec_jmp_inited = false;
static sigjmp_buf reexec_jmp_buf;
+static bool arg_default_cpuset_clone_children = false;
static int parse_configuration(const struct rlimit *saved_rlimit_nofile,
const struct rlimit *saved_rlimit_memlock);
@@ -527,6 +528,14 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
return 0;
parse_path_argument_and_warn(value, false, &arg_watchdog_device);
+
+ } else if (proc_cmdline_key_streq(key, "systemd.cpuset_clone_children") && value) {
+
+ r = parse_boolean(value);
+ if (r < 0)
+ log_warning("Failed to parse cpuset_clone_children switch %s. Ignoring.", value);
+ else
+ arg_default_cpuset_clone_children = r;
} else if (streq(key, "quiet") && !value) {
@@ -756,6 +765,7 @@ static int parse_config_file(void) {
{ "Manager", "DefaultTasksAccounting", config_parse_bool, 0, &arg_default_tasks_accounting },
{ "Manager", "DefaultTasksMax", config_parse_tasks_max, 0, &arg_default_tasks_max },
{ "Manager", "CtrlAltDelBurstAction", config_parse_emergency_action, 0, &arg_cad_burst_action },
+ { "Manager", "DefaultCPUSetCloneChildren",config_parse_bool, 0, &arg_default_cpuset_clone_children },
{}
};
@@ -1872,6 +1882,64 @@ static void log_execution_mode(bool *ret_first_boot) {
}
}
+static bool is_use_triple_cgroup(void) {
+ const char * path ="/sys/fs/cgroup/cpuset";
+ _cleanup_strv_free_ char **l = NULL;
+ char buf[128] = {0};
+ int r;
+
+ r = is_symlink(path);
+ if (r <= 0)
+ return false;
+
+ r = readlink(path, buf, sizeof(buf));
+ if (r < 0 || (unsigned int)r >= sizeof(buf))
+ return false;
+
+ buf[r] = '\0';
+ l = strv_split(buf, ",");
+ if (!l)
+ return false;
+
+ strv_sort(l);
+ if (strv_length(l) != 3)
+ return false;
+
+ if (streq(l[0],"cpu") && streq(l[1], "cpuacct") &&
+ streq(l[2], "cpuset")) {
+ log_debug(PACKAGE_STRING " use_triple_cgroup: %s", buf);
+ return true;
+ }
+ return false;
+}
+
+static int ali_handle_cpuset_clone_children(void)
+{
+ const char *file = "/sys/fs/cgroup/cpuset/cgroup.clone_children";
+ _cleanup_free_ char *buf = NULL;
+ int r;
+
+ r = read_one_line_file(file, &buf);
+ if (r < 0) {
+ log_warning_errno(r, "Cannot read %s: %m", file);
+ return r;
+ }
+
+ if (streq(buf, "1") && arg_default_cpuset_clone_children)
+ return 0;
+
+ if (streq(buf, "0") && (!arg_default_cpuset_clone_children))
+ return 0;
+
+ if (!is_use_triple_cgroup())
+ return 0;
+
+ r = write_string_file(file, one_zero(arg_default_cpuset_clone_children), 0);
+ log_info(PACKAGE_STRING " set %s to %s, ret=%d", file, one_zero(arg_default_cpuset_clone_children), r);
+ return r;
+}
+
+
static int initialize_runtime(
bool skip_setup,
struct rlimit *saved_rlimit_nofile,
@@ -1906,6 +1974,7 @@ static int initialize_runtime(
return r;
}
+ ali_handle_cpuset_clone_children();
status_welcome();
hostname_setup();
machine_id_setup(NULL, arg_machine_id, NULL);
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。