Page MenuHomeFreeBSD

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

Authored by kib on Nov 9 2021, 8:18 AM.
Tags
None
Referenced Files
F102588319: D32901.diff
Thu, Nov 14, 11:16 AM
Unknown Object (File)
Thu, Nov 7, 5:01 PM
Unknown Object (File)
Wed, Nov 6, 2:04 PM
Unknown Object (File)
Fri, Nov 1, 12:16 PM
Unknown Object (File)
Thu, Oct 31, 6:05 AM
Unknown Object (File)
Thu, Oct 24, 9:30 PM
Unknown Object (File)
Tue, Oct 22, 1:06 PM
Unknown Object (File)
Wed, Oct 16, 7:35 PM
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.