mirror of
https://github.com/systemd/systemd.git
synced 2024-11-02 02:21:44 +03:00
core: move where we send unit change updates to oomd
Post-merge suggestion from #15206
This commit is contained in:
parent
8922eddad6
commit
f561e8c659
@ -226,7 +226,7 @@ $1.IPIngressFilterPath, config_parse_ip_filter_bpf_progs,
|
|||||||
$1.IPEgressFilterPath, config_parse_ip_filter_bpf_progs, 0, offsetof($1, cgroup_context.ip_filters_egress)
|
$1.IPEgressFilterPath, config_parse_ip_filter_bpf_progs, 0, offsetof($1, cgroup_context.ip_filters_egress)
|
||||||
$1.ManagedOOMSwap, config_parse_managed_oom_mode, 0, offsetof($1, cgroup_context.moom_swap)
|
$1.ManagedOOMSwap, config_parse_managed_oom_mode, 0, offsetof($1, cgroup_context.moom_swap)
|
||||||
$1.ManagedOOMMemoryPressure, config_parse_managed_oom_mode, 0, offsetof($1, cgroup_context.moom_mem_pressure)
|
$1.ManagedOOMMemoryPressure, config_parse_managed_oom_mode, 0, offsetof($1, cgroup_context.moom_mem_pressure)
|
||||||
$1.ManagedOOMMemoryPressureLimitPercent, config_parse_managed_oom_mem_pressure_limit, 0, offsetof($1, cgroup_context)
|
$1.ManagedOOMMemoryPressureLimitPercent, config_parse_managed_oom_mem_pressure_limit, 0, offsetof($1, cgroup_context.moom_mem_pressure_limit)
|
||||||
$1.NetClass, config_parse_warn_compat, DISABLED_LEGACY, 0'
|
$1.NetClass, config_parse_warn_compat, DISABLED_LEGACY, 0'
|
||||||
)m4_dnl
|
)m4_dnl
|
||||||
Unit.Description, config_parse_unit_string_printf, 0, offsetof(Unit, description)
|
Unit.Description, config_parse_unit_string_printf, 0, offsetof(Unit, description)
|
||||||
|
@ -3824,7 +3824,6 @@ int config_parse_managed_oom_mode(
|
|||||||
const char *rvalue,
|
const char *rvalue,
|
||||||
void *data,
|
void *data,
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
Unit *u = userdata;
|
|
||||||
ManagedOOMMode *mode = data, m;
|
ManagedOOMMode *mode = data, m;
|
||||||
UnitType t;
|
UnitType t;
|
||||||
|
|
||||||
@ -3836,7 +3835,7 @@ int config_parse_managed_oom_mode(
|
|||||||
|
|
||||||
if (isempty(rvalue)) {
|
if (isempty(rvalue)) {
|
||||||
*mode = MANAGED_OOM_AUTO;
|
*mode = MANAGED_OOM_AUTO;
|
||||||
goto finish;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
m = managed_oom_mode_from_string(rvalue);
|
m = managed_oom_mode_from_string(rvalue);
|
||||||
@ -3845,9 +3844,6 @@ int config_parse_managed_oom_mode(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*mode = m;
|
*mode = m;
|
||||||
|
|
||||||
finish:
|
|
||||||
(void) manager_varlink_send_managed_oom_update(u);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3862,8 +3858,7 @@ int config_parse_managed_oom_mem_pressure_limit(
|
|||||||
const char *rvalue,
|
const char *rvalue,
|
||||||
void *data,
|
void *data,
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
Unit *u = userdata;
|
int *limit = data;
|
||||||
CGroupContext *c = data;
|
|
||||||
UnitType t;
|
UnitType t;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -3874,8 +3869,8 @@ int config_parse_managed_oom_mem_pressure_limit(
|
|||||||
return log_syntax(unit, LOG_WARNING, filename, line, 0, "%s= is not supported for this unit type, ignoring.", lvalue);
|
return log_syntax(unit, LOG_WARNING, filename, line, 0, "%s= is not supported for this unit type, ignoring.", lvalue);
|
||||||
|
|
||||||
if (isempty(rvalue)) {
|
if (isempty(rvalue)) {
|
||||||
c->moom_mem_pressure_limit = 0;
|
*limit = 0;
|
||||||
goto finish;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = parse_percent(rvalue);
|
r = parse_percent(rvalue);
|
||||||
@ -3884,12 +3879,7 @@ int config_parse_managed_oom_mem_pressure_limit(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
c->moom_mem_pressure_limit = r;
|
*limit = r;
|
||||||
|
|
||||||
finish:
|
|
||||||
/* Only update the limit if memory pressure detection is enabled because the information is irrelevant otherwise */
|
|
||||||
if (c->moom_mem_pressure == MANAGED_OOM_KILL)
|
|
||||||
(void) manager_varlink_send_managed_oom_update(u);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1684,6 +1684,7 @@ int unit_load(Unit *u) {
|
|||||||
|
|
||||||
unit_add_to_dbus_queue(unit_follow_merge(u));
|
unit_add_to_dbus_queue(unit_follow_merge(u));
|
||||||
unit_add_to_gc_queue(u);
|
unit_add_to_gc_queue(u);
|
||||||
|
(void) manager_varlink_send_managed_oom_update(u);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -2630,7 +2631,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, UnitNotifyFlag
|
|||||||
* sets one of the ManagedOOM*= properties to "kill", then later removes it. systemd-oomd needs to
|
* sets one of the ManagedOOM*= properties to "kill", then later removes it. systemd-oomd needs to
|
||||||
* know to stop monitoring when the unit changes from "kill" -> "auto" on daemon-reload, but we don't
|
* know to stop monitoring when the unit changes from "kill" -> "auto" on daemon-reload, but we don't
|
||||||
* have the information on the property. Thus, indiscriminately send an update. */
|
* have the information on the property. Thus, indiscriminately send an update. */
|
||||||
if (UNIT_IS_INACTIVE_OR_FAILED(ns) || ns == UNIT_ACTIVE)
|
if (UNIT_IS_INACTIVE_OR_FAILED(ns) || UNIT_IS_ACTIVE_OR_RELOADING(ns))
|
||||||
(void) manager_varlink_send_managed_oom_update(u);
|
(void) manager_varlink_send_managed_oom_update(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user