Page MenuHomeFreeBSD

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

Authored by kib on Nov 9 2021, 8:18 AM.
Tags
None
Referenced Files
F81841977: D32901.diff
Mon, Apr 22, 2:39 AM
Unknown Object (File)
Fri, Mar 29, 7:18 AM
Unknown Object (File)
Feb 16 2024, 9:15 PM
Unknown Object (File)
Feb 9 2024, 5:26 PM
Unknown Object (File)
Jan 10 2024, 8:58 AM
Unknown Object (File)
Jan 10 2024, 8:58 AM
Unknown Object (File)
Jan 10 2024, 8:38 AM
Unknown Object (File)
Dec 23 2023, 2:02 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.