Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix if no NUMA support in kernel #2127

Merged
merged 1 commit into from
Dec 17, 2018
Merged
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
14 changes: 8 additions & 6 deletions machine/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ func parseCapacity(b []byte, r *regexp.Regexp) (uint64, error) {
return m * 1024, err
}

/* look for sysfs cpu path containing core_id */
/* such as: sys/bus/cpu/devices/cpu0/topology/core_id */
/* Look for sysfs cpu path containing core_id */
/* Such as: sys/bus/cpu/devices/cpu0/topology/core_id */
func getCoreIdFromCpuBus(cpuBusPath string, threadId int) (int, error) {
path := filepath.Join(cpuBusPath, fmt.Sprintf("cpu%d/topology", threadId))
file := filepath.Join(path, "core_id")
Expand All @@ -154,8 +154,8 @@ func getCoreIdFromCpuBus(cpuBusPath string, threadId int) (int, error) {
return int(coreId), nil
}

/* look for sysfs cpu path containing node id */
/* such as: /sys/bus/cpu/devices/cpu0/node%d */
/* Look for sysfs cpu path containing node id */
/* Such as: /sys/bus/cpu/devices/cpu0/node%d */
func getNodeIdFromCpuBus(cpuBusPath string, threadId int) (int, error) {
path := filepath.Join(cpuBusPath, fmt.Sprintf("cpu%d", threadId))

Expand Down Expand Up @@ -235,13 +235,15 @@ func GetTopology(sysFs sysfs.SysFs, cpuinfo string) ([]info.Node, int, error) {
if isAArch64() {
val, err = getCoreIdFromCpuBus(cpuBusPath, lastThread)
if err != nil {
return nil, -1, fmt.Errorf("could not parse core info from %q: %v", cpuBusPath, err)
// Report thread id if no NUMA
val = lastThread
}
lastCore = val

val, err = getNodeIdFromCpuBus(cpuBusPath, lastThread)
if err != nil {
return nil, -1, fmt.Errorf("could not parse node info from %q: %v", cpuBusPath, err)
// Report node 0 if no NUMA
val = 0
}
lastNode = val
}
Expand Down