OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1 0/2] sched: Fix incorrect nproc report inside CT
@ 2026-10-27 20:51 Vladimir Riabchun
  2026-10-27 20:51 ` [Devel] [PATCH hci-8.1 1/2] sched: Fix sched_getaffinity syscall Vladimir Riabchun
  2026-10-27 20:51 ` [Devel] [PATCH hci-8.1 2/2] selftests: ve: Test sched_getaffinity in VE Vladimir Riabchun
  0 siblings, 2 replies; 5+ messages in thread
From: Vladimir Riabchun @ 2026-10-27 20:51 UTC (permalink / raw)
  To: ptikhomirov, Konstantin Khorenko; +Cc: devel

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 <vladimir.riabchun@virtuozzo.com>
---
Vladimir Riabchun (2):
      sched: Fix sched_getaffinity syscall
      selftests: ve: Test sched_getaffinity in VE

 kernel/sched/syscalls.c                            |  13 +-
 tools/testing/selftests/ve/.gitignore              |   1 +
 tools/testing/selftests/ve/Makefile                |   1 +
 .../selftests/ve/ve_sched_getaffinity_test.c       | 147 +++++++++++++++++++++
 4 files changed, 156 insertions(+), 6 deletions(-)
---
base-commit: a1c0fd720976500f854fd5a4c946a54e65c82d78
change-id: 20261027-ct-invalid-nrpoc-f183b3ba691d

Best regards,
--  
Vladimir Riabchun <vladimir.riabchun@virtuozzo.com>

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-28 10:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-27 20:51 [Devel] [PATCH hci-8.1 0/2] sched: Fix incorrect nproc report inside CT Vladimir Riabchun
2026-10-27 20:51 ` [Devel] [PATCH hci-8.1 1/2] sched: Fix sched_getaffinity syscall Vladimir Riabchun
2026-10-28  9:34   ` Pavel Tikhomirov
2026-10-28 10:30     ` Vladimir Riabchun
2026-10-27 20:51 ` [Devel] [PATCH hci-8.1 2/2] selftests: ve: Test sched_getaffinity in VE Vladimir Riabchun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox