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: 7 additions & 2 deletions sysfs/system_cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
package sysfs

import (
"errors"
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
"syscall"

"golang.org/x/sync/errgroup"

Expand Down Expand Up @@ -281,9 +283,12 @@ func parseCpufreqCpuinfo(cpuPath string) (*SystemCPUCpufreqStats, error) {
uintOut := make([]*uint64, len(uintFiles))

for i, f := range uintFiles {
v, err := parsers.ReadUintFromFile(filepath.Join(cpuPath, f))
// os.ReadFile would park forever in the netpoller if the read returns
// EAGAIN, which cpuinfo_avg_freq does on arm64 when every CPU in the
// policy is idle. Treat that as the value being unavailable.
v, err := parsers.SysReadUintFromFile(filepath.Join(cpuPath, f))
if err != nil {
if os.IsNotExist(err) || os.IsPermission(err) {
if os.IsNotExist(err) || os.IsPermission(err) || errors.Is(err, syscall.EAGAIN) {
continue
}
return &SystemCPUCpufreqStats{}, err
Expand Down