Skip to content

Commit

Permalink
Read core and physical package ID of the CPUs that are online
Browse files Browse the repository at this point in the history
Signed-off-by: Kishen V <kishen.viswanathan@ibm.com>

Revert changes to fix breaking changes for ARM

Signed-off-by: Kishen V <kishen.viswanathan@ibm.com>
  • Loading branch information
kishen-v committed Apr 3, 2024
1 parent 2650af7 commit 9740fa1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/cpu/cpu_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

var (
regexForCpulCore = regexp.MustCompile("^cpu([0-9]+)$")
onlineFile = "online"
)

func (i *Info) load() error {
Expand Down Expand Up @@ -64,6 +65,10 @@ func processorsGet(ctx *context.Context) []*Processor {
continue
}

onlineFilePath := filepath.Join(paths.SysDevicesSystemCPU, fmt.Sprintf("cpu%d", lpID), onlineFile)
if util.SafeIntFromFile(ctx, onlineFilePath) == 0 {
continue
}
procID := processorIDFromLogicalProcessorID(ctx, lpID)
proc, found := procs[procID]
if !found {
Expand Down Expand Up @@ -201,6 +206,10 @@ func CoresForNode(ctx *context.Context, nodeID int) ([]*ProcessorCore, error) {
)
continue
}
onlineFilePath := filepath.Join(cpuPath, onlineFile)
if util.SafeIntFromFile(ctx, onlineFilePath) == 0 {
continue
}
coreIDPath := filepath.Join(cpuPath, "topology", "core_id")
coreID := util.SafeIntFromFile(ctx, coreIDPath)
core := findCoreByID(coreID)
Expand Down

0 comments on commit 9740fa1

Please sign in to comment.