We observed weird nproc behavior - it reported 64 CPUs no matter what the CT limits were or how many CPUs the host actually had.
nproc code uses sched_getaffinity syscall under the hood[1]. It appears that this syscall returned complete nonsence when called from VE - we ignored both num_online_vcpus and cgroup cpuset limitations. Now it is fixed and a new selftest is added. [1]: https://github.com/coreutils/gnulib/blob/master/lib/nproc.c#L144 https://virtuozzo.atlassian.net/browse/VSTOR-141682 Signed-off-by: Vladimir Riabchun <[email protected]> --- Changes in v3: - Patch 1: num_online_vcpus() -> task_nr_cpus(p) - Patch 2: updated a comment and moved CPU check in setup fixture to the top. - Link to v2: http://lore.virtuozzo.com/[email protected] Changes in v2: - Updated vCPU logic in patch 1. Now we don't return actual cpumask, insted first min(vcpu, count(mask)) bits are set. This is closer to the real CT resources. - Patch 2: adjusted logic and added one more test. - Link to v1: http://lore.virtuozzo.com/[email protected] --- Vladimir Riabchun (2): sched: Fix sched_getaffinity syscall selftests: ve: Test sched_getaffinity in VE kernel/sched/syscalls.c | 18 +- tools/testing/selftests/ve/.gitignore | 1 + tools/testing/selftests/ve/Makefile | 1 + .../selftests/ve/ve_sched_getaffinity_test.c | 211 +++++++++++++++++++++ 4 files changed, 226 insertions(+), 5 deletions(-) --- base-commit: b499efa17aa9fb8f20512d1831d1cb61b22e60d3 change-id: 20261027-ct-invalid-nrpoc-f183b3ba691d Best regards, -- Vladimir Riabchun <[email protected]> _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
