Skip to content

Can't get the correct information from /proc/stat #628

Open
@hejiahang929

Description

@hejiahang929

I can get correct information from /proc/cpuinfo and /sys/devices/system/cpu/online, but can't get the correct information from /proc/stat, The information from /proc/stat is all cpus on hosts. Is there any missing configuration?

/proc/cpuinfo

cat /proc/cpuinfo |grep processor
processor	: 0
processor	: 1

/sys/devices/system/cpu/online

cat /sys/devices/system/cpu/online
0-1

/proc/stat

cat /proc/stat
cpu  53578 146 33020 23066313 1873 4506 3573 0 0 0
cpu0 1119 3 801 573933 52 1889 1263 0 0 0
cpu1 1095 4 732 577008 39 65 174 0 0 0
cpu2 1058 2 597 577284 38 58 96 0 0 0
cpu3 1086 4 590 577321 30 56 61 0 0 0
cpu4 1246 5 610 577143 47 56 35 0 0 0
cpu5 1278 4 580 577134 31 58 38 0 0 0
cpu6 1077 3 652 577253 40 59 40 0 0 0
cpu7 1295 3 752 576737 55 89 142 0 0 0
cpu8 1053 4 596 577173 92 64 45 0 0 0
cpu9 1123 4 611 577205 55 58 39 0 0 0
cpu10 1714 3 1062 575911 68 76 46 0 0 0
cpu11 2592 4 1339 574465 26 104 406 0 0 0
cpu12 1499 3 1114 576183 57 112 42 0 0 0
cpu13 1508 4 1008 576388 49 65 44 0 0 0
cpu14 1417 4 962 576506 62 64 39 0 0 0
cpu15 1438 5 958 576483 68 67 48 0 0 0
cpu16 1397 3 942 576568 24 66 47 0 0 0
cpu17 1462 5 982 576460 79 62 44 0 0 0
cpu18 1362 3 1035 576539 33 64 45 0 0 0
cpu19 1340 6 954 576536 73 64 60 0 0 0
cpu20 1669 3 720 576590 29 65 40 0 0 0
cpu21 1065 4 628 577142 33 58 37 0 0 0
cpu22 1064 3 606 577350 16 58 32 0 0 0
cpu23 1002 4 576 577403 33 57 35 0 0 0
cpu24 996 4 582 577371 77 58 34 0 0 0
cpu25 962 3 558 577472 42 55 35 0 0 0
cpu26 1024 4 616 577343 42 57 49 0 0 0
cpu27 965 3 609 577404 57 56 30 0 0 0
cpu28 1556 2 610 576842 40 56 29 0 0 0
cpu29 1113 3 657 577196 56 60 41 0 0 0
cpu30 1628 4 1018 576272 29 66 45 0 0 0
cpu31 1579 6 1092 576176 68 68 45 0 0 0
cpu32 1532 3 1046 576352 36 68 41 0 0 0
cpu33 1419 2 976 576420 30 134 54 0 0 0
cpu34 1543 3 1048 576279 87 70 44 0 0 0
cpu35 1859 4 961 576101 34 67 39 0 0 0
cpu36 1419 4 966 576527 35 65 55 0 0 0
cpu37 1357 4 956 576612 48 64 38 0 0 0
cpu38 1371 4 967 576573 31 63 49 0 0 0
cpu39 1296 3 951 576658 32 65 47 0 0 0
...

lxcfs --version

"5.0.4"

systemctl status lxcfs
● lxcfs.service - FUSE filesystem for LXC
Loaded: loaded (/usr/lib/systemd/system/lxcfs.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2024-03-14 19:38:44 CST; 1h 18min ago
Docs: man:lxcfs(1)
Main PID: 1296 (lxcfs)
Tasks: 6
Memory: 31.6M
CGroup: /system.slice/lxcfs.service
└─1296 /usr/bin/lxcfs -l --enable-cfs --enable-pidfd /var/lib/lxc/lxcfs/

mount info

k8s version 1.27

    volumeMounts:
    - mountPath: /proc/meminfo
      name: lxcfs-proc-meminfo
    - mountPath: /proc/cpuinfo
      name: lxcfs-proc-cpuinfo
    - mountPath: /proc/diskstats
      name: lxcfs-proc-diskstats
    - mountPath: /proc/uptime
      name: lxcfs-proc-uptime
    - mountPath: /proc/stat
      name: lxcfs-proc-stat
    - mountPath: /proc/swaps
      name: lxcfs-proc-swaps
    - mountPath: /proc/loadavg
      name: lxcfs-proc-loadavg
    - mountPath: /sys/devices/system/cpu/online
      name: lxcfs-cpu-online

  volumes:
  - hostPath:
      path: /var/lib/lxc/lxcfs/proc/meminfo
      type: ""
    name: lxcfs-proc-meminfo
  - hostPath:
      path: /var/lib/lxc/lxcfs/proc/cpuinfo
      type: ""
    name: lxcfs-proc-cpuinfo
  - hostPath:
      path: /var/lib/lxc/lxcfs/proc/diskstats
      type: ""
    name: lxcfs-proc-diskstats
  - hostPath:
      path: /var/lib/lxc/lxcfs/proc/uptime
      type: ""
    name: lxcfs-proc-uptime
  - hostPath:
      path: /var/lib/lxc/lxcfs/proc/stat
      type: ""
    name: lxcfs-proc-stat
  - hostPath:
      path: /var/lib/lxc/lxcfs/proc/swaps
      type: ""
    name: lxcfs-proc-swaps
  - hostPath:
      path: /var/lib/lxc/lxcfs/proc/loadavg
      type: ""
    name: lxcfs-proc-loadavg
  - hostPath:
      path: /var/lib/lxc/lxcfs/sys/devices/system/cpu/online
      type: ""
    name: lxcfs-cpu-online

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugConfirmed to be a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions