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)
Thu, May 9, 2:16 AM
Unknown Object (File)
Sat, Apr 27, 4:36 AM
Unknown Object (File)
Sat, Apr 27, 4:35 AM
Unknown Object (File)
Sat, Apr 27, 4:35 AM
Unknown Object (File)
Sat, Apr 27, 3:18 AM
Unknown Object (File)
Tue, Apr 23, 12:22 PM
Unknown Object (File)
Mon, Apr 22, 2:39 AM
Unknown Object (File)
Mar 29 2024, 7:18 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 Skipped
Unit
Tests Skipped

Event Timeline

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

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

Yes we do, I added it several years ago.