[lxc-users] Followup: Issue concerning total CPU usage in top (package procps)

Jäkel, Guido G.Jaekel at dnb.de
Thu Jan 10 09:25:11 UTC 2019


Hi all,

Comparing the sources I may found a regression in the source code

root at genlab /var/tmp/portage/sys-process/procps-3.3.15-r1/work/procps-ng-3.3.15 # diff -u top/top.c{.20180519-134813,}                                                                 
--- top/top.c.20180519-134813   2018-05-19 13:48:13.784997373 +0200
+++ top/top.c   2019-01-10 10:19:56.496652093 +0100
@@ -2640,6 +2640,7 @@
          , &cpu_ptr->cur.u, &cpu_ptr->cur.n, &cpu_ptr->cur.s
          , &cpu_ptr->cur.i, &cpu_ptr->cur.w, &cpu_ptr->cur.x
          , &cpu_ptr->cur.y, &cpu_ptr->cur.z)) {
+            memmove(cpu_ptr, sum_ptr, sizeof(CPU_t));
             break;        // tolerate cpus taken offline
       }

Adding the missing statement will revert the issue. I'll contact the psproc package maintainer about the intention of this change.

Greetings

Guido


>-----Original Message-----
>From: lxc-users [mailto:lxc-users-bounces at lists.linuxcontainers.org] On Behalf Of Jäkel, Guido
>Sent: Thursday, January 10, 2019 9:26 AM
>To: 'lxc-users' <lxc-users at lists.linuxcontainers.org>
>Subject: [lxc-users] Issue concerning total CPU usage in top (package procps)
>
>Dear all,
>
>I'm using Gentoo for LXC host and containers. After upgrading the procps package from 3.3.12 to 3.3.15, in the top application
>the value of summed CPU usage inside a container is always 0 (zero).
>
>* This issue shows up in the containers only, but not on the host
>* If I switch the display to show the value for individual CPUs, it "works"
>* This was not the case with the former used 3.3.12
>
>A quick look at the source code of top show that it seems to use /proc/stat. Watching a 'head -1 /proc/stat' show changing
>values for the cpu line - no surprise since the v3.12 of top will work. The versions of the relevant component I'm currently
>using:
>
>* Kernel 4.14.79-gentoo
>* lxcfs-3.0
>
>May somebody confirm this quirk using another Linux Distribution and/or LXC version?
>
>
>Thank you in advance
>
>Guido
>
>
>_______________________________________________
>lxc-users mailing list
>lxc-users at lists.linuxcontainers.org
>http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list