]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: add missing MemoryPressureWatch= and MemoryPressureThresholdSec= setting
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 9 Mar 2023 12:49:32 +0000 (21:49 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 9 Mar 2023 14:43:04 +0000 (23:43 +0900)
Follow-up for #26393.

Addresses https://github.com/systemd/systemd/pull/26393#issuecomment-1458655798.

src/core/load-fragment-gperf.gperf.in
src/core/load-fragment.c
src/core/load-fragment.h
src/core/main.c
test/fuzz/fuzz-unit-file/directives-all.service

index 2a8a10819b32e9fcdf9b5f13ed6b1bd6f7767f66..d78d6eca91ad8f4e19f4ce47f16d4dcd5112123f 100644 (file)
 {{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 -%}
 
 %{
index 8577e9ef5433d8d129aad81bc0d7b651758de57e..0a36cee35cfeb8bab51cb105efda1e833a9a6ce6 100644 (file)
@@ -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");
index 68ceeaec81879130c8dfefebc78fb03113ca5881..7fd82e34cc96b1ccfb5d8c026321266a86b60471 100644 (file)
@@ -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);
index 0bd7937f54f835fedff6c8a28ecfe5eef7a0fedb..79eaa4e5d637808d8524ee050537d6664a30500c 100644 (file)
@@ -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                              },
index f8237d74ebbbabee315dd286c248ea2c06f5afc2..8450d024e608b457b8c1a612ea7e55307776aca8 100644 (file)
@@ -159,6 +159,8 @@ MemoryHigh=
 MemoryLimit=
 MemoryLow=
 MemoryMax=
+MemoryPressureThresholdSec=
+MemoryPressureWatch=
 MemorySwapMax=
 MemoryZSwapMax=
 MessageQueueMaxMessages=