New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the handling of memory allocation for tmpfs. #40
Conversation
@mrunalp PTAL |
https://bugzilla.redhat.com/show_bug.cgi?id=1406435 |
Looks fine. Will test and merge.
… On Dec 20, 2016, at 7:47 AM, Daniel J Walsh ***@***.***> wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1406435
Covers this issue in a little more depth.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This crashed when I tried to start docker container setting memory. |
This is what I see in the logs:
|
Ok what command did you use to cause this? |
@@ -510,9 +527,9 @@ static int prestart(const char *rootfs, | |||
} | |||
|
|||
if (!strcmp("", mount_label)) { | |||
rc = asprintf(&options, "mode=1777,size=%" PRIu64 "k", memory_limit_in_kb); | |||
rc = asprintf(&options, "mode=1777%s", memory_str); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a comma between mode and size.
if (memory_limit_in_bytes < total_memory) { | ||
/* Set it to half of limit in kb */ | ||
uint64_t memory_limit_in_kb = memory_limit_in_bytes / 2048; | ||
snprintf(memory_str, sizeof(memory_str)-1 , "size=%" PRIu64 "k", memory_limit_in_kb); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can add the comma before size here.
|
If the total memory on the system is less then the max memory in cgroup then do not set memory limit on tmpfs, allow the kernel to set the default.
Put the "," back in, and am setting up a test. |
docker run -ti --memory=1G fedora mount | grep /tmp docker run -ti fedora mount | grep /tmp |
LGTM |
If the total memory on the system is less then the max memory in cgroup
then do not set memory limit on tmpfs, allow the kernel to set the default.