linux: fix uv_available_parallelism using cgroup #4278
linux: fix uv_available_parallelism using cgroup #4278bnoordhuis merged 20 commits intolibuv:v1.xfrom
Conversation
|
Any idea why the ASAN build is failing ? |
bnoordhuis
left a comment
There was a problem hiding this comment.
Thanks for the PR. I pointed out single instances of style issues but please fix them all.
The ASAN buildbot is known to be problematic at the moment. You can just ignore it.
|
@bnoordhuis I fixed styling issues and added tests directly in test-platform-output.c. It might be a bit ugly though, happy to have your feedback on it To test it manually I built it with the following Dockerfile # Use the official Ubuntu base image
FROM ubuntu:20.04
# Update the package list
RUN apt-get update
# Install cmake and other build dependencies
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y cmake libtool autoconf build-essential
# Fix : for some reason cmake is looking for gmake instead of make
RUN ln -s /usr/bin/make /usr/bin/gmake
# Set the working directory inside the container
WORKDIR /workspace
# Create a user 'libuv' and give ownership of /workspace to 'libuv'
RUN useradd -m libuv && chown -R libuv:libuv /workspace
# Switch to the 'libuv' user
USER libuv
# Copy the current directory contents into the container at /workspace
COPY --chown=libuv:libuv ./ /workspace/
# Run the build steps as 'libuv' user
RUN mkdir -p build
RUN (cd build && cmake .. -DBUILD_TESTING=ON)
RUN cmake --build build
# By default, run a shell
CMD ["/bin/sh", "-c", "/workspace/build/uv_run_tests platform_output"]And following commands $ docker build . libuv-test-cgroup
$ docker run --cpus="2" libuv-test-cgroup | grep available It correctly outputs 2 available cpus
|
|
@bnoordhuis have you other feedbacks ? |
|
Can you rebase on top of the v1.x branch? It looks like you're a few commits behind. |
f5bf3c6 to
deda40d
Compare
✅ |
uv_available_parallelism does not handle container cpu limit set by systems like Docker or Kubernetes. This patch fixes this limitation by comparing the amount of available cpus returned by syscall with the quota of cpus available defined in cgroup See issue: libuv#4146
Not working yet
deda40d to
dd4d126
Compare
|
@bnoordhuis I rebased on v1.x |
bnoordhuis
left a comment
There was a problem hiding this comment.
Thanks, LGTM.
@libuv/collaborators can one of you give this a quick high-level look-over?
santigimeno
left a comment
There was a problem hiding this comment.
LGTM with a couple of comments.
|
@santigimeno @bnoordhuis any idea when this can be merged ? |
|
I'll go ahead and merge it. Thanks for the pull request. |
uv_available_parallelism does not handle container cpu limit set by systems like Docker or Kubernetes. This patch fixes this limitation by comparing the amount of available cpus returned by syscall with the quota of cpus available defined in the cgroup. Fixes: libuv#4146 (cherry picked from commit 6b56200)
uv_available_parallelism does not handle container cpu limit set by systems like Docker or Kubernetes. This patch fixes this limitation by comparing the amount of available cpus returned by syscall with the quota of cpus available defined in the cgroup. Fixes: libuv#4146 (cherry picked from commit 6b56200)
This includes * JuliaLang/libuv#38, backport of libuv/libuv#4521 * JuliaLang/libuv#39, backport of libuv/libuv#4278
This includes * JuliaLang/libuv#38, backport of libuv/libuv#4521 * JuliaLang/libuv#39, backport of libuv/libuv#4278
This includes * JuliaLang/libuv#38, backport of libuv/libuv#4521 * JuliaLang/libuv#39, backport of libuv/libuv#4278
Corresponding PR to Yggdrasil: JuliaPackaging/Yggdrasil#9337. This build includes backports of libuv/libuv#4278 (useful for for #46226) and libuv/libuv#4521 (useful for #55592)
Corresponding PR to Yggdrasil: JuliaPackaging/Yggdrasil#9337. This build includes backports of libuv/libuv#4278 (useful for for #46226) and libuv/libuv#4521 (useful for #55592)
Corresponding PR to Yggdrasil: JuliaPackaging/Yggdrasil#9337. This build includes backports of libuv/libuv#4278 (useful for for #46226) and libuv/libuv#4521 (useful for #55592)

PR to fix #4146