-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
check memory limits for cgroupv1 #27
Conversation
high = uv__read_uint64(filename); | ||
} else { | ||
p = strchr(buf, ':'); | ||
while (p != NULL && memcmp(p, ":memory:", 8)) { |
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.
oh wait, I realise this isn't how cgroups work...
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.
Actually, I think it is correct? But it would be good for someone who understands these things to check.
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 take it slurm creates a cgroup subtree? On my cgroupv1 system, the limit sits at /sys/fs/cgroup/memory
directly. It'd be useful to add a comment here about what you're doing, that's easier to review than to parse C code 🙂
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.
Yes, that appears to be how cgroupv1 works, e.g. https://unix.stackexchange.com/a/621576
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.
Apparently we're still missing something though, as on my cgroup1 system with Docker, I can't access even the memory subgroup listed in /proc/self/cgroup
.
The fallbacks were already intended to address cgroupv1. What is wrong with those? |
It isn't giving the correct result on our Slurm cluster. If I do:
|
Any thoughts on this? I'd really like to get this into 1.9 (or ideally backported to 1.8). |
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.
LGTM. I'm sure upstream will have more comments though, so could you create a PR there once I have our pending changes merged?
high = uv__read_uint64(filename); | ||
} else { | ||
p = strchr(buf, ':'); | ||
while (p != NULL && memcmp(p, ":memory:", 8)) { |
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 take it slurm creates a cgroup subtree? On my cgroupv1 system, the limit sits at /sys/fs/cgroup/memory
directly. It'd be useful to add a comment here about what you're doing, that's easier to review than to parse C code 🙂
max = uv__read_uint64(filename); | ||
snprintf(filename, sizeof(filename), "/sys/fs/cgroup/memory/%s/memory.soft_limit_in_bytes", p); | ||
high = uv__read_uint64(filename); | ||
} | ||
|
||
if (max == 0) |
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.
if (max == 0 || high == 0)
Actually, I'll try to upstream it, since I'm working on that right now anyway. |
Thanks, please let me know if I can do anything to help. |
I updated your PR to still correctly read out the limits I'm seeing (ref #27 (comment)) and pushed that to libuv#3754. Can you verify that works with your SLURM system? |
Superseded by #32 |
Seems to fix issue with JuliaLang/julia#46796 (comment)
I admit I know very little about cgroups, or C programming, so this may well be incorrect, but it was able to correctly determine the cgroup limits on our Slurm cluster