Skip to content

Commit cf1c33f

Browse files
committed
Remove thermal_throttle masked paths.
Signed-off-by: Ayato Tokubi <[email protected]>
1 parent 9f047e1 commit cf1c33f

File tree

1 file changed

+0
-59
lines changed

1 file changed

+0
-59
lines changed

server/masked_paths.go

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
package server
22

33
import (
4-
"fmt"
5-
"os"
6-
"runtime"
74
"slices"
8-
"strconv"
9-
"strings"
105
"sync"
116

127
"github.com/containers/common/pkg/config"
@@ -28,59 +23,5 @@ var defaultLinuxMaskedPaths = sync.OnceValue(func() []string {
2823
[]string{"/proc/asound", "/proc/interrupts"},
2924
)
3025

31-
for _, cpu := range possibleCPUs() {
32-
path := fmt.Sprintf("/sys/devices/system/cpu/cpu%d/thermal_throttle", cpu)
33-
if _, err := os.Stat(path); err == nil {
34-
maskedPaths = append(maskedPaths, path)
35-
}
36-
}
37-
3826
return maskedPaths
3927
})
40-
41-
// possibleCPUs returns the number of possible CPUs on this host.
42-
func possibleCPUs() (cpus []int) {
43-
if ncpu := possibleCPUsParsed(); ncpu != nil {
44-
return ncpu
45-
}
46-
47-
for i := range runtime.NumCPU() {
48-
cpus = append(cpus, i)
49-
}
50-
51-
return cpus
52-
}
53-
54-
// possibleCPUsParsed is parsing the amount of possible CPUs on this host from
55-
// /sys/devices.
56-
var possibleCPUsParsed = sync.OnceValue(func() (cpus []int) {
57-
data, err := os.ReadFile("/sys/devices/system/cpu/possible")
58-
if err != nil {
59-
return nil
60-
}
61-
62-
for r := range strings.SplitSeq(strings.TrimSpace(string(data)), ",") {
63-
if rStart, rEnd, ok := strings.Cut(r, "-"); !ok {
64-
cpu, err := strconv.Atoi(rStart)
65-
if err != nil {
66-
return nil
67-
}
68-
cpus = append(cpus, cpu)
69-
} else {
70-
var start, end int
71-
start, err := strconv.Atoi(rStart)
72-
if err != nil {
73-
return nil
74-
}
75-
end, err = strconv.Atoi(rEnd)
76-
if err != nil {
77-
return nil
78-
}
79-
for i := start; i <= end; i++ {
80-
cpus = append(cpus, i)
81-
}
82-
}
83-
}
84-
85-
return cpus
86-
})

0 commit comments

Comments
 (0)