Skip to content

Commit

Permalink
Merge pull request #127 from consideRatio/pr/update-memorylimit
Browse files Browse the repository at this point in the history
Replace deprecated MemoryLimit with MemoryMax, remove fixme notes
  • Loading branch information
yuvipanda authored Jun 1, 2023
2 parents 38875b4 + cc9b545 commit 9917cbd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions systemdspawner/systemdspawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,19 @@ async def start(self):
env["SHELL"] = self.default_shell

if self.mem_limit is not None:
# FIXME: Detect & use proper properties for v1 vs v2 cgroups
properties["MemoryAccounting"] = "yes"
properties["MemoryLimit"] = self.mem_limit
properties["MemoryMax"] = self.mem_limit

if self.cpu_limit is not None:
# FIXME: Detect & use proper properties for v1 vs v2 cgroups
# FIXME: Make sure that the kernel supports CONFIG_CFS_BANDWIDTH
# otherwise this doesn't have any effect.
# NOTE: The linux kernel must be compiled with the configuration option
# CONFIG_CFS_BANDWIDTH, otherwise CPUQuota doesn't have any
# effect.
#
# This can be checked with the check-kernel.bash script in
# this git repository.
#
# ref: https://github.com/systemd/systemd/blob/v245/README#L35
#
properties["CPUAccounting"] = "yes"
properties["CPUQuota"] = f"{int(self.cpu_limit * 100)}%"

Expand Down

0 comments on commit 9917cbd

Please sign in to comment.