diff options
Diffstat (limited to 'src/core/load-fragment.c')
-rw-r--r-- | src/core/load-fragment.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index a2eede4cce..c1a4eb96cb 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -3372,6 +3372,12 @@ int config_parse_memory_limit( uint64_t bytes = CGROUP_LIMIT_MAX; int r; + if (STR_IN_SET(lvalue, "DefaultMemoryLow", + "DefaultMemoryMin", + "MemoryLow", + "MemoryMin")) + bytes = CGROUP_LIMIT_MIN; + if (!isempty(rvalue) && !streq(rvalue, "infinity")) { r = parse_permille(rvalue); @@ -3391,24 +3397,20 @@ int config_parse_memory_limit( } } + /* Keep Memory{Low,Min} unset with empty assignment so that we fall back to DefaultMemory* which in + * contrast means zeroing the property. */ if (streq(lvalue, "DefaultMemoryLow")) { + c->default_memory_low = bytes; c->default_memory_low_set = true; - if (isempty(rvalue)) - c->default_memory_low = CGROUP_LIMIT_MIN; - else - c->default_memory_low = bytes; } else if (streq(lvalue, "DefaultMemoryMin")) { + c->default_memory_min = bytes; c->default_memory_min_set = true; - if (isempty(rvalue)) - c->default_memory_min = CGROUP_LIMIT_MIN; - else - c->default_memory_min = bytes; } else if (streq(lvalue, "MemoryMin")) { c->memory_min = bytes; - c->memory_min_set = true; + c->memory_min_set = !isempty(rvalue); } else if (streq(lvalue, "MemoryLow")) { c->memory_low = bytes; - c->memory_low_set = true; + c->memory_low_set = !isempty(rvalue); } else if (streq(lvalue, "MemoryHigh")) c->memory_high = bytes; else if (streq(lvalue, "MemoryMax")) |