File tree Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -184,16 +184,8 @@ func tryResetCPUAffinity(pid int) {
184184 //
185185 // So we can just pass a very large array of set cpumask bits and the
186186 // kernel will silently convert that to the correct value very cheaply.
187-
188- // Ideally, we would just set the array to 0xFF...FF. Unfortunately, the
189- // size depends on the architecture. It is also a private newtype, so we
190- // can't use (^0) or generics since those require us to be able to name the
191- // type. However, we can just underflow the zero value instead.
192- // TODO: Once <https://golang.org/cl/698015> is merged, switch to that.
193- cpuset := unix.CPUSet {}
194- for i := range cpuset {
195- cpuset [i ]-- // underflow to 0xFF..FF
196- }
187+ var cpuset unix.CPUSet
188+ cpuset .Fill () // set all bits
197189 if err := unix .SchedSetaffinity (pid , & cpuset ); err != nil {
198190 logrus .WithError (
199191 os .NewSyscallError ("sched_setaffinity" , err ),
You can’t perform that action at this time.
0 commit comments