Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions unix/affinity_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ func (s *CPUSet) Zero() {
}
}

// Fill adds all possible CPU bits to the set s. On Linux, [SchedSetaffinity]
// will silently ignore any invalid CPU bits in [CPUSet] so this is an
// efficient way of resetting the CPU affinity of a process.
func (s *CPUSet) Fill() {
for i := range s {
s[i] = ^cpuMask(0)
}
}

func cpuBitsIndex(cpu int) int {
return cpu / _NCPUBITS
}
Expand Down