Re: git: c21b080f3dc2 - main - cpuset: Fix sched_[g|s]etaffinity() for better compatibility with Linux.
- Reply: Dmitry Chagin : "Re: git: c21b080f3dc2 - main - cpuset: Fix sched_[g|s]etaffinity() for better compatibility with Linux."
- In reply to: Dmitry Chagin : "git: c21b080f3dc2 - main - cpuset: Fix sched_[g|s]etaffinity() for better compatibility with Linux."
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 12 Feb 2023 09:47:15 UTC
On Sun, Jan 29, 2023 at 1:18 PM Dmitry Chagin <dchagin@freebsd.org> wrote:
>
> The branch main has been updated by dchagin:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=c21b080f3dc2f5e91ada608d4385b7ed6538ba9b
>
> commit c21b080f3dc2f5e91ada608d4385b7ed6538ba9b
> Author: Dmitry Chagin <dchagin@FreeBSD.org>
> AuthorDate: 2023-01-29 13:17:33 +0000
> Commit: Dmitry Chagin <dchagin@FreeBSD.org>
> CommitDate: 2023-01-29 13:17:33 +0000
>
> cpuset: Fix sched_[g|s]etaffinity() for better compatibility with Linux.
>
> Under Linux to sched_[g|s]etaffinity() functions the value returned from a call
> to gettid(2) (thread id) can be passed in the argument pid. Specifying pid as 0
> will set the attribute for the calling thread, and passing the value returned
> from a call to getpid(2) (process id) will set the attribute for the main thread
> of the thread group.
>
> Native cpuset(2) family of system calls has "which" argument to determine how
> the value of id argument is interpreted, i.e., CPU_WHICH_TID is used to pass
> a thread id and CPU_WHICH_PID - to pass a process id.
>
> For now native sched_[g|s]etaffinity() implementation is wrong as uses "which"
> CPU_WHICH_PID to pass both (process and thread id) to the kernel. To fix this
> adding a new "which" CPU_WHICH_TIDPID intended to handle both id's.
>
> Reviewed by: kib
> Differential Revision: https://reviews.freebsd.org/D38209
> MFC after: 1 week
> ---
> lib/libc/gen/sched_getaffinity.c | 2 +-
> lib/libc/gen/sched_setaffinity.c | 2 +-
> lib/libc/sys/cpuset.2 | 4 +++-
> sys/kern/kern_cpuset.c | 42 +++++++++++++++++++++++++++++++++++++++-
> sys/sys/cpuset.h | 1 +
> 5 files changed, 47 insertions(+), 4 deletions(-)
Hello,
This broke math/py-numpy on main and stable/13
https://pkg-status.freebsd.org/gohan03/data/main-amd64-default-baseline/p52768539d46f_scd3193f640/logs/errors/py39-numpy-1.24.1,1.log
https://pkg-status.freebsd.org/gohan02/data/13stable-amd64-quarterly-baseline/841610d9bfc6/logs/errors/py39-numpy-1.23.5_1,1.log
File "/wrkdirs/usr/ports/math/py-numpy/work-py39/numpy-1.23.5/numpy/distutils/misc_util.py",
line 93, in get_num_build_jobs
cpu_count = len(os.sched_getaffinity(0))
OverflowError: could not allocate a large enough CPU set
Cheers,
Antoine