Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bundle/lib/source/DobbySpecConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ static const ctemplate::StaticTemplateString USERNS_DISABLED =

static const ctemplate::StaticTemplateString MEM_LIMIT =
STS_INIT(MEM_LIMIT, "MEM_LIMIT");
static const ctemplate::StaticTemplateString MEM_SWAP_LIMIT =
STS_INIT(MEM_SWAP_LIMIT, "MEM_SWAP_LIMIT");

static constexpr unsigned MEM_SWAP_LIMIT_EXTRA_BYTES = 200u * 1024u * 1024u;

static const ctemplate::StaticTemplateString CPU_SHARES_ENABLED =
STS_INIT(CPU_SHARES_ENABLED, "CPU_SHARES_ENABLED");
Expand Down Expand Up @@ -1274,6 +1278,7 @@ bool DobbySpecConfig::processMemLimit(const Json::Value& value,
}

dictionary->SetIntValue(MEM_LIMIT, memLimit);
dictionary->SetIntValue(MEM_SWAP_LIMIT, memLimit + MEM_SWAP_LIMIT_EXTRA_BYTES);
Comment thread
goruklu marked this conversation as resolved.

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static const char* ociJsonTemplate = R"JSON(
],
"memory": {
"limit": {{MEM_LIMIT}},
"swap": {{MEM_LIMIT}},
"swap": {{MEM_SWAP_LIMIT}},
"swappiness": 60
},
"cpu": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ static const char* ociJsonTemplate = R"JSON(
],
"memory": {
"limit": {{MEM_LIMIT}},
"swap": {{MEM_LIMIT}},
"swap": {{MEM_SWAP_LIMIT}},
"swappiness": 60
},
"cpu": {
Expand Down
Loading