Skip to content

Commit

Permalink
koordlet: fix lscpu for arm64 (koordinator-sh#1792)
Browse files Browse the repository at this point in the history
Signed-off-by: 佑祎 <zzw261520@alibaba-inc.com>
  • Loading branch information
zwzhang0107 authored Dec 25, 2023
1 parent f4d0fb9 commit 47f6715
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkg/koordlet/util/system/lscpu_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ func GetCacheInfo(str string) (string, int32, error) {
if s == "-" {
return "0", 0, nil
}
// otherwise we suppose the input is valid cache info
// assert l1, l2 are private cache, so they has the same id with the core
// followings are same with amd64
// assert l1, l2 are private cache, so they have the same id with the core
// L3 cache maybe not available, when the host is qemu-kvm. detail: https://bugzilla.redhat.com/show_bug.cgi?id=1434537
infos := strings.Split(s, ":")
if len(infos) != 4 {
return "", 0, fmt.Errorf("invalid format for cache info")
if len(infos) < 3 {
return "", 0, fmt.Errorf("invalid cache info %s", str)
}
l1l2 := infos[0]
l3, err := strconv.Atoi(infos[3])
if len(infos) == 3 {
return l1l2, 0, nil
}
l3, err := strconv.ParseInt(infos[3], 10, 32)
if err != nil {
return "", 0, err
}
Expand Down

0 comments on commit 47f6715

Please sign in to comment.