From 74fc378230f8bc138bf0f01661914d2951008093 Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Wed, 8 May 2019 09:44:58 -0700 Subject: [PATCH] Clarify comment around memswap & memory --- repo2docker/buildpacks/base.py | 7 ++++--- repo2docker/buildpacks/docker.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/repo2docker/buildpacks/base.py b/repo2docker/buildpacks/base.py index e6cb3916..a11dd1ed 100644 --- a/repo2docker/buildpacks/base.py +++ b/repo2docker/buildpacks/base.py @@ -530,9 +530,10 @@ class BuildPack: "integer but is '{}'".format(type(memory_limit))) limits = {} if memory_limit: - # We'd like to always disable swap but all we can do is set the - # total amount. This means we only limit it when the caller set - # a memory limit + # We want to always disable swap. Docker expects `memswap` to + # be total allowable memory, *including* swap - while `memory` + # points to non-swap memory. We set both values to the same so + # we use no swap. limits = { 'memory': memory_limit, 'memswap': memory_limit diff --git a/repo2docker/buildpacks/docker.py b/repo2docker/buildpacks/docker.py index 3f3c09a4..5f437b36 100644 --- a/repo2docker/buildpacks/docker.py +++ b/repo2docker/buildpacks/docker.py @@ -28,9 +28,10 @@ class DockerBuildPack(BuildPack): "integer but is '{}'".format(type(memory_limit))) limits = {} if memory_limit: - # We'd like to always disable swap but all we can do is set the - # total amount. This means we onnly limit it when the caller set - # a memory limit + # We want to always disable swap. Docker expects `memswap` to + # be total allowable memory, *including* swap - while `memory` + # points to non-swap memory. We set both values to the same so + # we use no swap. limits = { 'memory': memory_limit, 'memswap': memory_limit,