Skip to content

Commit 66a892a

Browse files
committed
core: accept MemorySwapMax= properties that are scaled, too
Let's do what we already do for MemoryMax= and friends for MemorySwapMax= too.
1 parent 421eaea commit 66a892a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/core/dbus-cgroup.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ int bus_cgroup_set_property(
10541054

10551055
return 1;
10561056

1057-
} else if (STR_IN_SET(name, "MemoryLowScale", "MemoryHighScale", "MemoryMaxScale")) {
1057+
} else if (STR_IN_SET(name, "MemoryLowScale", "MemoryHighScale", "MemoryMaxScale", "MemorySwapMaxScale")) {
10581058
uint32_t raw;
10591059
uint64_t v;
10601060

@@ -1077,7 +1077,9 @@ int bus_cgroup_set_property(
10771077
c->memory_low = v;
10781078
else if (streq(name, "MemoryHigh"))
10791079
c->memory_high = v;
1080-
else
1080+
else if (streq(name, "MemorySwapMaxScale"))
1081+
c->memory_swap_max = v;
1082+
else /* MemoryMax */
10811083
c->memory_max = v;
10821084

10831085
unit_invalidate_cgroup(u, CGROUP_MASK_MEMORY);
@@ -1100,7 +1102,7 @@ int bus_cgroup_set_property(
11001102
c->memory_limit = limit;
11011103
unit_invalidate_cgroup(u, CGROUP_MASK_MEMORY);
11021104

1103-
if (limit == (uint64_t) -1)
1105+
if (limit == CGROUP_LIMIT_MAX)
11041106
unit_write_setting(u, flags, name, "MemoryLimit=infinity");
11051107
else
11061108
unit_write_settingf(u, flags, name, "MemoryLimit=%" PRIu64, limit);

0 commit comments

Comments
 (0)