Page MenuHomeFreeBSD

sched.h, sched_getcpu(), sched_get/setaffinity()
ClosedPublic

Authored by kib on Nov 9 2021, 8:18 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jan 17, 1:57 PM
Unknown Object (File)
Tue, Jan 3, 8:00 AM
Unknown Object (File)
Dec 7 2022, 9:56 AM
Unknown Object (File)
Nov 27 2022, 6:52 PM
Unknown Object (File)
Nov 27 2022, 11:53 AM
Subscribers

Details

Summary
Add real sched.h

It is required by IEEE Std 1003.1-2008 AKA POSIX.

Put some Linux compatibility stuff under BSD_VISIBLE namespace, in
particular, sys/cpuset.h definitions.  Also, if user really want
Linux compatibility, she can request cpu_set_t typedef with
_WITH_CPU_SET_T define.
Add sched_get/setaffinity
 
 for compatibility with Linux. [*]
  • Yes I know that this is racy. The API is needed for providing seed for D32505
Add sched_getcpu()

for compatibility with Linux.
x86: provide userspace implementation of sched_getcpu() where possible
sched.h: add CPU_EQUAL() for better compatibility with Linux

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Nov 9 2021, 8:18 AM
sys/kern/syscalls.master
3265–3267 ↗(On Diff #98226)
jhb added inline comments.
lib/libc/x86/sys/sched_getcpu_x86.c
58 ↗(On Diff #98226)

Do we already store the FreeBSD CPU-ID in the MSR that rdtscp returns in %rcx I guess? Ah, yes, we do in initializecpu(). It seems that is the same thing rdpid returns as well.

This revision is now accepted and ready to land.Nov 9 2021, 5:59 PM
kib marked an inline comment as done.Nov 9 2021, 6:28 PM
kib marked an inline comment as done.Nov 9 2021, 6:42 PM
kib added inline comments.
lib/libc/x86/sys/sched_getcpu_x86.c
58 ↗(On Diff #98226)

Yes we do, I added it several years ago.