Also cache thread tid to avoid ref to an unlocked thread.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 45252 Build 42140: arc lint + arc unit
Event Timeline
Note that FreeBSD would benefit from similar changes in the native API btw. As it was we can't safely raise MAXCPU in the default amd64 kernel (for example) because it breaks the ABI since old kernels would be too pick about userland having a larger size. It would be good perhaps to fix the native syscalls to adopt Linux's more flexible semantics and then you would not need to change the Linux ABI itself.
There are e.g. sched_setaffinity(3) and cpuset_setaffinity(2). First is 'linux-ish' and is currently implemented as libc wrapper, while second is the native syscall. I do not object against moving FreeBSD native primitive to be more linux-like, but this is quite hard to do, I will try to explain.
I added very naive sched_get/setaffinity(3) libc wrappers only to improve the source-level compatibility with Linux, after spending a lot of time at least twice converting ucx (this is some wrapper/foundation for transport for openmpi and like) and then tcmalloc. The result was exactly opposite, it makes a lot of software packages note glibc-like API and depending on every small nit in the behavior. You might remember the CPUSET(3) saga, and also look at the git log for lib/libc/gen/sched_*affinity.c.
There is probably less code that would try to exercise such knowledge for cpuset_* API, but who knows.
From your changes, I see at least one more compat shim we probably should add, D35045