summaryrefslogtreecommitdiffstats
path: root/src/core/cgroup.c
diff options
context:
space:
mode:
authorAnita Zhang <the.anitazha@gmail.com>2020-03-09 23:09:17 +0100
committerAnita Zhang <the.anitazha@gmail.com>2020-10-08 01:17:23 +0200
commit4d824a4e0b008a359adda0e960706316f207047e (patch)
tree04c5b68e821899102206ae1be6746632aa96d9cd /src/core/cgroup.c
parentunit: don't emit PropertiesChanged signal if adding a dependency to a unit is... (diff)
downloadsystemd-4d824a4e0b008a359adda0e960706316f207047e.tar.xz
systemd-4d824a4e0b008a359adda0e960706316f207047e.zip
core: add ManagedOOM*= properties to configure systemd-oomd on the unit
This adds the hook ups so it can be read with the usual systemd utilities. Used in later commits by sytemd-oomd.
Diffstat (limited to 'src/core/cgroup.c')
-rw-r--r--src/core/cgroup.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 211e4a5945..95b5f2de59 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -128,6 +128,9 @@ void cgroup_context_init(CGroupContext *c) {
.startup_blockio_weight = CGROUP_BLKIO_WEIGHT_INVALID,
.tasks_max = TASKS_MAX_UNSET,
+
+ .moom_swap = MANAGED_OOM_AUTO,
+ .moom_mem_pressure = MANAGED_OOM_AUTO,
};
}
@@ -411,7 +414,10 @@ void cgroup_context_dump(Unit *u, FILE* f, const char *prefix) {
"%sTasksMax: %" PRIu64 "\n"
"%sDevicePolicy: %s\n"
"%sDisableControllers: %s\n"
- "%sDelegate: %s\n",
+ "%sDelegate: %s\n"
+ "%sManagedOOMSwap: %s\n"
+ "%sManagedOOMMemoryPressure: %s\n"
+ "%sManagedOOMMemoryPressureLimitPercent: %d%%\n",
prefix, yes_no(c->cpu_accounting),
prefix, yes_no(c->io_accounting),
prefix, yes_no(c->blockio_accounting),
@@ -441,7 +447,10 @@ void cgroup_context_dump(Unit *u, FILE* f, const char *prefix) {
prefix, tasks_max_resolve(&c->tasks_max),
prefix, cgroup_device_policy_to_string(c->device_policy),
prefix, strempty(disable_controllers_str),
- prefix, yes_no(c->delegate));
+ prefix, yes_no(c->delegate),
+ prefix, managed_oom_mode_to_string(c->moom_swap),
+ prefix, managed_oom_mode_to_string(c->moom_mem_pressure),
+ prefix, c->moom_mem_pressure_limit);
if (c->delegate) {
_cleanup_free_ char *t = NULL;