-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Expose constrained memory limits and have the GC use them #46796
Conversation
This works as expected:
The GC should automatically use this, but in addition I guess we want to expose this to the Julia user. Anybody any thoughts on an interface? The easiest solution would be for |
I would be in favor of making |
And that could always be provided with a |
Yeah I agree. I pushed a change to We should probably make
The GC also uses |
It would require adding something like |
Well I just added that now to make this backport more similar to the one on master. But in what way would it conflict? |
Sorry, I read it backwards. Right, so this will conflict less with the backports, once that is merged. |
We need to query cgroup's |
It would be great if 1.8.2 could include this. |
We want to release 1.8.2 quite soon so the question here is what the time frame in #46796 (comment):
Upstream libuv is moving quite slow and I don't want 1.8.2 to have to wait a significant time for them to review something. So the options I see are:
|
After speaking to @maleadt, it seems reasonable to put this behind a feature flag in 1.8.2 since changing the default GC behavior in a patch release is probably a bit too intrusive. |
I believe the memory utilization is way higher in many workloads compared to 1.7. This should be the default, I feel. Is it because of the small part left? And would be default on 1.8.3? |
This PR should be complete. I'll do some more testing tomorrow and create a backport version for 1.8. The only user-visible change is the addition of |
(cherry picked from commit 89c4a2a)
I'm trying this on the current nightly (f927d25) on our Slurm cluster which enforces memory limits via cgroups, and it doesn't seem to match with what I see: julia> Sys.total_physical_memory() / 2^20 # physical mem (MB)
257693.1796875
julia> Sys.total_memory() / 2^20 # should be memory limit (MB)
257693.1796875
julia> mem_cgroup = match(r".*:memory:(.*)", read("/proc/$(getpid())/cgroup", String)).captures[1] # current memory cgroup
"/slurm/uid_5184/job_28896711/step_0"
julia> parse(Int, readchomp("/sys/fs/cgroup/memory/$mem_cgroup/memory.limit_in_bytes")) / 2^20 # cgroup memory limit (MB)
2048.0 |
For reference: julia> ccall(:uv_get_constrained_memory, UInt64, ())
0x0000000000000000 |
Ah, okay, it looks like we're not using cgroups2. 😦 |
Just as a test. Could you use Hwloc.jl to see what it prints out? |
what command in particular?
|
That was the one I was thinking of. I'm not sure they have others. But it seems it doesn't see the limit as well. |
I have a proposed fix at JuliaLang/libuv#27, I'm not sure if it's correct though |
This includes libuv/libuv#3744, which should make it possible to fix #24617. I still need to verify this, so marking this PR draft until I do.
According to @vtjnash, it should also be safe to backport this to JuliaLang/libuv#24 (comment).