Skip to content

Commit bd6021d

Browse files
authored
Merge pull request #4927 from cyphar/1.4-cpuset-fill
[1.4] libct: switch to (*CPUSet).Fill
2 parents 2e3b2fb + 5aa229f commit bd6021d

File tree

17 files changed

+611
-513
lines changed

17 files changed

+611
-513
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased 1.4.z]
88

9+
### Fixed
10+
* Switched to `(*CPUSet).Fill` rather than our hacky optimisation when
11+
resetting the CPU affinity of runc. (#4926, #4927)
12+
913
## [1.4.0-rc.2] - 2025-10-10
1014

1115
> 私の役目は信じるかどうかではない。行うかどうかだ。

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
github.com/vishvananda/netlink v1.3.1
2424
github.com/vishvananda/netns v0.0.5
2525
golang.org/x/net v0.43.0
26-
golang.org/x/sys v0.35.0
26+
golang.org/x/sys v0.37.0
2727
google.golang.org/protobuf v1.36.8
2828
)
2929

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
8484
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
8585
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
8686
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
87-
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
88-
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
87+
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
88+
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
8989
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
9090
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
9191
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

libcontainer/process_linux.go

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

vendor/golang.org/x/sys/unix/affinity_linux.go

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/fdset.go

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/ifreq_linux.go

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/mkall.sh

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/syscall_linux.go

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/golang.org/x/sys/unix/syscall_netbsd.go

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)