summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2023-03-09 23:35:29 +0100
committerGitHub <noreply@github.com>2023-03-09 23:35:29 +0100
commitd56391b40f8676392b0bfacf70a8832c0aeda375 (patch)
treee560fefaec3b94afb3e3be2ca4512aabef2322f9
parentmempress: change default PSI window duration to 2s (diff)
parentsystem.conf: add default for memory pressure settings (diff)
downloadsystemd-d56391b40f8676392b0bfacf70a8832c0aeda375.tar.xz
systemd-d56391b40f8676392b0bfacf70a8832c0aeda375.zip
Merge pull request #26731 from yuwata/mempressure-follow-ups
Mempressure follow ups
-rw-r--r--src/core/load-fragment-gperf.gperf.in2
-rw-r--r--src/core/load-fragment.c2
-rw-r--r--src/core/load-fragment.h2
-rw-r--r--src/core/main.c2
-rw-r--r--src/core/system.conf.in2
-rw-r--r--src/core/user.conf.in2
-rw-r--r--test/fuzz/fuzz-unit-file/directives-all.service2
7 files changed, 11 insertions, 3 deletions
diff --git a/src/core/load-fragment-gperf.gperf.in b/src/core/load-fragment-gperf.gperf.in
index 2a8a10819b..d78d6eca91 100644
--- a/src/core/load-fragment-gperf.gperf.in
+++ b/src/core/load-fragment-gperf.gperf.in
@@ -249,6 +249,8 @@
{{type}}.SocketBindAllow, config_parse_cgroup_socket_bind, 0, offsetof({{type}}, cgroup_context.socket_bind_allow)
{{type}}.SocketBindDeny, config_parse_cgroup_socket_bind, 0, offsetof({{type}}, cgroup_context.socket_bind_deny)
{{type}}.RestrictNetworkInterfaces, config_parse_restrict_network_interfaces, 0, offsetof({{type}}, cgroup_context)
+{{type}}.MemoryPressureThresholdSec, config_parse_sec, 0, offsetof({{type}}, cgroup_context.memory_pressure_threshold_usec)
+{{type}}.MemoryPressureWatch, config_parse_memory_pressure_watch, 0, offsetof({{type}}, cgroup_context.memory_pressure_watch)
{%- endmacro -%}
%{
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 8577e9ef54..0a36cee35c 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -146,7 +146,7 @@ DEFINE_CONFIG_PARSE_ENUM(config_parse_service_timeout_failure_mode, service_time
DEFINE_CONFIG_PARSE_ENUM(config_parse_socket_bind, socket_address_bind_ipv6_only_or_bool, SocketAddressBindIPv6Only, "Failed to parse bind IPv6 only value");
DEFINE_CONFIG_PARSE_ENUM(config_parse_oom_policy, oom_policy, OOMPolicy, "Failed to parse OOM policy");
DEFINE_CONFIG_PARSE_ENUM(config_parse_managed_oom_preference, managed_oom_preference, ManagedOOMPreference, "Failed to parse ManagedOOMPreference=");
-DEFINE_CONFIG_PARSE_ENUM(config_parse_cgroup_pressure_watch, cgroup_pressure_watch, CGroupPressureWatch, "Failed to parse CGroupPressureWatch=");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_memory_pressure_watch, cgroup_pressure_watch, CGroupPressureWatch, "Failed to parse memory pressure watch setting");
DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_ip_tos, ip_tos, int, -1, "Failed to parse IP TOS value");
DEFINE_CONFIG_PARSE_PTR(config_parse_blockio_weight, cg_blkio_weight_parse, uint64_t, "Invalid block IO weight");
DEFINE_CONFIG_PARSE_PTR(config_parse_cg_weight, cg_weight_parse, uint64_t, "Invalid weight");
diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h
index 68ceeaec81..7fd82e34cc 100644
--- a/src/core/load-fragment.h
+++ b/src/core/load-fragment.h
@@ -152,7 +152,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_watchdog_sec);
CONFIG_PARSER_PROTOTYPE(config_parse_tty_size);
CONFIG_PARSER_PROTOTYPE(config_parse_log_filter_patterns);
CONFIG_PARSER_PROTOTYPE(config_parse_open_file);
-CONFIG_PARSER_PROTOTYPE(config_parse_cgroup_pressure_watch);
+CONFIG_PARSER_PROTOTYPE(config_parse_memory_pressure_watch);
/* gperf prototypes */
const struct ConfigPerfItem* load_fragment_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
diff --git a/src/core/main.c b/src/core/main.c
index 0bd7937f54..79eaa4e5d6 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -690,7 +690,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", "DefaultMemoryPressureThresholdSec", config_parse_sec, 0, &arg_default_memory_pressure_threshold_usec },
- { "Manager", "DefaultMemoryPressureWatch", config_parse_cgroup_pressure_watch, 0, &arg_default_memory_pressure_watch },
+ { "Manager", "DefaultMemoryPressureWatch", config_parse_memory_pressure_watch, 0, &arg_default_memory_pressure_watch },
{ "Manager", "CtrlAltDelBurstAction", config_parse_emergency_action, arg_system, &arg_cad_burst_action },
{ "Manager", "DefaultOOMPolicy", config_parse_oom_policy, 0, &arg_default_oom_policy },
{ "Manager", "DefaultOOMScoreAdjust", config_parse_oom_score_adjust, 0, NULL },
diff --git a/src/core/system.conf.in b/src/core/system.conf.in
index 9572b57f17..309c7500f8 100644
--- a/src/core/system.conf.in
+++ b/src/core/system.conf.in
@@ -73,6 +73,8 @@
#DefaultLimitNICE=
#DefaultLimitRTPRIO=
#DefaultLimitRTTIME=
+#DefaultMemoryPressureThresholdSec=200ms
+#DefaultMemoryPressureWatch=auto
#DefaultOOMPolicy=stop
#DefaultSmackProcessLabel=
#ReloadLimitIntervalSec=
diff --git a/src/core/user.conf.in b/src/core/user.conf.in
index d67650b858..a445dff5d0 100644
--- a/src/core/user.conf.in
+++ b/src/core/user.conf.in
@@ -48,6 +48,8 @@
#DefaultLimitNICE=
#DefaultLimitRTPRIO=
#DefaultLimitRTTIME=
+#DefaultMemoryPressureThresholdSec=200ms
+#DefaultMemoryPressureWatch=auto
#DefaultSmackProcessLabel=
#ReloadLimitIntervalSec=
#ReloadLimitBurst
diff --git a/test/fuzz/fuzz-unit-file/directives-all.service b/test/fuzz/fuzz-unit-file/directives-all.service
index f8237d74eb..8450d024e6 100644
--- a/test/fuzz/fuzz-unit-file/directives-all.service
+++ b/test/fuzz/fuzz-unit-file/directives-all.service
@@ -159,6 +159,8 @@ MemoryHigh=
MemoryLimit=
MemoryLow=
MemoryMax=
+MemoryPressureThresholdSec=
+MemoryPressureWatch=
MemorySwapMax=
MemoryZSwapMax=
MessageQueueMaxMessages=