I am running ubuntu 18.04 on a old(ish) laptop, it's a hp dv7 6180sl with upgraded ram (16gb) and SSD. It's old but still fast enough for my job.
Since a few ubuntu versions (I always do a complete reinstall at every release, so I'm not coming from an older version) it looks like the cpu is never really idle, thus tha fans are always working. Today I have decided to find out what is using my cpu.
I've read lots of answers here and on google, but nothing really solved my problem. Top says this:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5501 tox 20 0 3911436 324668 68984 S 12,5 4,0 30:04.86 gnome-shell
Taking the PID of gnome-shell, I've tried to do a strace to see what happens under the hood, and I saw that there is a recvmsg
syscall that gives a big amount of errors, taking almost 30% of the time (this is after almost a minute):
strace: Process 5501 attached
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
29.71 0.100941 2 46612 39214 recvmsg
24.81 0.084290 5 17842 poll
22.21 0.075445 3 21796 ioctl
8.92 0.030304 4 7269 writev
3.72 0.012652 8 1583 53 futex
3.17 0.010771 2 5180 getpid
1.58 0.005380 1 3874 mprotect
1.58 0.005357 3 2003 write
1.46 0.004969 3 1958 read
0.51 0.001727 8 215 2 openat
0.48 0.001634 3 501 close
0.45 0.001533 5 288 timerfd_create
0.32 0.001098 4 288 timerfd_settime
0.32 0.001072 6 183 mmap
0.26 0.000887 7 132 114 stat
0.25 0.000838 2 426 fstat
0.11 0.000370 2 213 fcntl
0.08 0.000267 10 26 munmap
0.06 0.000191 1 146 getrusage
0.00 0.000001 0 4 1 recvfrom
0.00 0.000001 1 2 uname
0.00 0.000001 1 1 restart_syscall
------ ----------- ----------- --------- --------- ----------------
100.00 0.339729 110542 39384 total
Is that something I should worry about?
I have had similar consistent high CPU load on gnome-shell for no clear reason since installing 18.04. I figured it was just obscuring something under the hood like firefox video rendering, but it also doesn't really go down anywhere near zero even with every program closed and even without moving the mouse.
I tried the same strace and get similar results:
It's pretty bad, I have stuttering at about a 1 sec interval across all my programs. It's so consistent I've gotten used to compensating for it. Video playback stutters, games stutter, firefox stutters, it's pretty annoying. No idea where to start on fixing it, though killing gnome-shell and restarting it at least works for a while -- still with the errors, but more responsive.
Side bar on the left often also glitches with overlapping icons and the like, I suspect there's some cumulative errors gnome-shell gets into and that at some point it is spending a lot of CPU time trying to resolve badly interacting contradictions between some configuration or edge case or something. I guess at this point I'll just hope 18.10 is any better.