-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Remove 1024 CPUs limit #5343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Remove 1024 CPUs limit #5343
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ package linux | |
|
|
||
| import ( | ||
| "os" | ||
| "unsafe" | ||
|
|
||
| "golang.org/x/sys/unix" | ||
| ) | ||
|
|
@@ -66,18 +65,10 @@ func Recvfrom(fd int, p []byte, flags int) (n int, from unix.Sockaddr, err error | |
| return n, from, err | ||
| } | ||
|
|
||
| // SchedSetaffinity wraps sched_setaffinity syscall without unix.CPUSet size limitation. | ||
| func SchedSetaffinity(pid int, buf []byte) error { | ||
| // SchedSetaffinity wraps [unix.SchedSetaffinityDynamic]. | ||
| func SchedSetaffinity(pid int, aff unix.CPUSetDynamic) error { | ||
| err := retryOnEINTR(func() error { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see you mentioned it;
Is this something we should still add in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By definition, x/sys/unix is a low-level thing so I guess they will not accept it. I also think (but not sure) that sched_setaffinity is safe wrt EINTR, as it's not a blocking call (like a syscall doing I/O).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, in principle almost any syscall can |
||
| _, _, errno := unix.Syscall( | ||
| unix.SYS_SCHED_SETAFFINITY, | ||
| uintptr(pid), | ||
| uintptr(len(buf)), | ||
| uintptr((unsafe.Pointer)(&buf[0]))) | ||
| if errno != 0 { | ||
| return errno | ||
| } | ||
| return nil | ||
| return unix.SchedSetaffinityDynamic(pid, aff) | ||
| }) | ||
| return os.NewSyscallError("sched_setaffinity", err) | ||
| } | ||
|
|
@@ -90,10 +81,10 @@ func Sendmsg(fd int, p, oob []byte, to unix.Sockaddr, flags int) error { | |
| return os.NewSyscallError("sendmsg", err) | ||
| } | ||
|
|
||
| // SetMempolicy wraps set_mempolicy. | ||
| func SetMempolicy(mode int, mask *unix.CPUSet) error { | ||
| // SetMempolicy wraps [unix.SetMempolicyDynamic]. | ||
| func SetMempolicy(mode int, mask unix.CPUSetDynamic) error { | ||
| err := retryOnEINTR(func() error { | ||
| return unix.SetMemPolicy(mode, mask) | ||
| return unix.SetMemPolicyDynamic(mode, mask) | ||
| }) | ||
| return os.NewSyscallError("set_mempolicy", err) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.