2

I'm having some issues with CPU usage when using wireless connection on my laptop.

This has never happened on wired connection, therefore I'm assuming wifi connection is somewhat related.

top says that most resources are used by gnome-shell, browser, and some kworker processes.

Situation also gets worse the more network resources are used (for example if I start a download). Here's an htop screen, as soon as I started a download several gnome-shell processes showed very high cpu usage: enter image description here

Tried using perf to see what uses the CPU most as suggested here: https://askubuntu.com/a/422151/700229 but couldn't find anything that would point me in the right direction, but the output was probably bad:

✓ ~→ sudo perf record -g -a sleep 10
Lowering default frequency rate to 1250.
Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate.
[ perf record: Woken up 9 times to write data ]
Warning:
Processed 52550 events and lost 2 chunks!

Check IO/CPU overload!

[ perf record: Captured and wrote 7.214 MB perf.data (26167 samples) ]

Here's the output of lspci -v:

3b:00.0 Network controller: Intel Corporation Wireless-AC 9260 (rev 29)
        Subsystem: Intel Corporation Device 4010
        Flags: bus master, fast devsel, latency 0, IRQ 16
        Memory at ed400000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: <access denied>
        Kernel driver in use: iwlwifi
        Kernel modules: iwlwifi

And iwconfig:

lo        no wireless extensions.

br-2d6609084b03  no wireless extensions.

br-7083ba6447c1  no wireless extensions.

docker0   no wireless extensions.

wlp59s0   IEEE 802.11  ESSID:"XXX"
          Mode:Managed  Frequency:5.5 GHz  Access Point: XX:XX:XX:XX:XX:XX
          Bit Rate=650 Mb/s   Tx-Power=22 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=45/70  Signal level=-65 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:7  Invalid misc:113   Missed beacon:0

I've checked that CPU is set to performance in tlp and that wifi battery saver is disabled.

Now I'm kind of lost here what to look for next. Any help is very appreciated because my work depends on resolving this.

UPD Installed gnome extensions:

✓ ~→ ls -al ~/.local/share/gnome-shell/extensions
total 80
drwxrwxr-x 20 sergio sergio 4096 Mar 15 17:33 .
drwx------  3 sergio sergio 4096 Mar 15 17:31 ..
drwxrwxr-x  3 sergio sergio 4096 Jul 24  2019 alternate-tab@gnome-shell-extensions.gcampax.github.com
drwxrwxr-x  3 sergio sergio 4096 Jun 13  2019 appindicatorsupport@rgcjonas.gmail.com
drwxrwxr-x  3 sergio sergio 4096 Mar 15 17:33 apps-menu@gnome-shell-extensions.gcampax.github.com
drwxrwxr-x  4 sergio sergio 4096 Aug  5  2019 auto-move-windows@gnome-shell-extensions.gcampax.github.com
drwxrwxr-x  5 sergio sergio 4096 Jun 13  2019 dash-to-dock@micxgx.gmail.com
drwxrwxr-x  3 sergio sergio 4096 Jul 24  2019 drive-menu@gnome-shell-extensions.gcampax.github.com
drwxrwxr-x  4 sergio sergio 4096 Feb 28 14:25 extensions@abteil.org
drwxrwxr-x  2 sergio sergio 4096 Sep 27 12:22 Hide_Activities@shay.shayel.org
drwxrwxr-x  2 sergio sergio 4096 Jul 24  2019 launch-new-instance@gnome-shell-extensions.gcampax.github.com
drwxrwxr-x  5 sergio sergio 4096 Feb 28 14:25 minimizeall@scharlessantos.org
drwxrwxr-x  3 sergio sergio 4096 Jul 24  2019 native-window-placement@gnome-shell-extensions.gcampax.github.com
drwxrwxr-x  2 sergio sergio 4096 Jun 13  2019 noannoyance@sindex.com
drwxrwxr-x  3 sergio sergio 4096 Jul 24  2019 places-menu@gnome-shell-extensions.gcampax.github.com
drwxrwxr-x  2 sergio sergio 4096 Sep 19 15:35 remove-dropdown-arrows@mpdeimos.com
drwxrwxr-x  4 sergio sergio 4096 Feb 22 16:20 syncthingicon@jay.strict@posteo.de
drwxrwxr-x  4 sergio sergio 4096 Jun 13  2019 update-extensions@franglais125.gmail.com
drwxrwxr-x  3 sergio sergio 4096 Jul 24  2019 user-theme@gnome-shell-extensions.gcampax.github.com
drwxrwxr-x  3 sergio sergio 4096 Aug  5  2019 windowsNavigator@gnome-shell-extensions.gcampax.github.com

✓ ~→ ls -al /usr/share/gnome-shell/extensions
total 48
drwxr-xr-x 12 root root 4096 Aug  5  2019 .
drwxr-xr-x  6 root root 4096 Jan 15 06:59 ..
drwxr-xr-x  2 root root 4096 Jun 13  2019 alternate-tab@gnome-shell-extensions.gcampax.github.com
drwxr-xr-x  2 root root 4096 Jun 13  2019 apps-menu@gnome-shell-extensions.gcampax.github.com
drwxr-xr-x  2 root root 4096 Jun 13  2019 auto-move-windows@gnome-shell-extensions.gcampax.github.com
drwxr-xr-x  2 root root 4096 Jun 13  2019 drive-menu@gnome-shell-extensions.gcampax.github.com
drwxr-xr-x  2 root root 4096 Jun 13  2019 launch-new-instance@gnome-shell-extensions.gcampax.github.com
drwxr-xr-x  2 root root 4096 Jun 13  2019 native-window-placement@gnome-shell-extensions.gcampax.github.com
drwxr-xr-x  2 root root 4096 Jun 13  2019 places-menu@gnome-shell-extensions.gcampax.github.com
drwxr-xr-x  2 root root 4096 Jun 13  2019 user-theme@gnome-shell-extensions.gcampax.github.com
drwxr-xr-x  2 root root 4096 Jun 13  2019 window-list@gnome-shell-extensions.gcampax.github.com.bak
drwxr-xr-x  2 root root 4096 Jun 13  2019 windowsNavigator@gnome-shell-extensions.gcampax.github.com

UPD2 htop in idle state: enter image description here

UPD3 free mem and swappiness:

✓ ~→ free -h
              total        used        free      shared  buff/cache   available
Mem:            30G        2.4G         24G        782M        3.6G         27G
Swap:           16G          0B         16G

✓ ~→ sysctl vm.swappiness
vm.swappiness = 10
  • You probably have some GNOME Shell extensions sucking up a bunch of CPU cycles. Edit your question and show me ls -al ~/.local/share/gnome-shell/extensions and ls -al /usr/share/gnome-shell/extensions. Start comments to me with @heynnema or I may miss them. – heynnema Mar 15 '20 at 16:31
  • Thanks @heynnema , this is actually what I was just checking myself. I've updated the question with the output. – SergioLeone Mar 15 '20 at 16:36
  • Please see my answer. It it turns out to be helpful, please remember to accept my answer by clicking the checkmark icon that appears just to the left of my answer. Thanks! – heynnema Mar 15 '20 at 16:45
  • Thanks for your input @heynnema. Was just doing the same myself after posting this question. Will mark your answer as accepted if this turns out to be the issue. What threw me off at first is that this only happens on high network usage while on wireless :/ I hope extensions are really the issue here. – SergioLeone Mar 15 '20 at 16:47

2 Answers2

0

Holy !@#$% Batman. You've got WAY too manu GNOME Shell extensions, and many of them are duplicated in both places where extensions should exist.

System extensions are seen with ls -al /usr/share/gnome-shell/extensions should only contain these (19.10):

drwxr-xr-x 2 root root 4096 Nov  2 14:36 desktop-icons@csoriano
drwxr-xr-x 3 root root 4096 Nov  2 14:36 ubuntu-appindicators@ubuntu.com
drwxr-xr-x 3 root root 4096 Mar 12 16:22 ubuntu-dock@ubuntu.com

User extensions are normally seen via ls -al ~/.local/share/gnome-shell/extensions.

Remove the duplicates in /usr/share/gnome-shell/extensions.

Then restart GNOME Shell, or better yet, just reboot.

Then temporarily turn OFF ALL remaining extensions at https://extensions.gnome.org/local/ and retest your system. Turn ON only one extension at a time during testing. Monitor the top command, and GNOME Shell CPU usage should be less than 2%. The goal would be to only have 5-6 extensions enabled max. Ditch the rest.

Then restart GNOME Shell, or better yet, just reboot.

heynnema
  • 70,711
  • I have tried disabling every extension. As a test running 720p video on youtube. Still seeing the same issue with high CPU usage, though now I don't see multiple gnome-shell processes eating up CPU apart from the main one (main shell?). Now there are several processes that pop-up: thermald, pulseaudio and browser. – SergioLeone Mar 15 '20 at 17:57
  • @SergioLeone Edit your question and show me the latest screenshot of top/htop when the computer is idle. – heynnema Mar 15 '20 at 18:00
  • @SergioLeone When viewing a 720p video, I'd expect CPU usage to be high. What does that have to do with your problem with wifi? Your recent htop looks normal. – heynnema Mar 15 '20 at 18:10
  • It's not that the usage is just "high", sorry for not being clear. It's that the system starts lagging and freezing, video starts lagging as well, etc. Again, this does not happen on wired network connection, only on wireless (and also I've tried with different wireless netowrks - at work and home - and results are same). I've used youtube to load up network, the behavior is the same if I, for example, download a file. – SergioLeone Mar 15 '20 at 18:11
  • @SergioLeone ah... edit your question and show me free -h and sysctl vm.swappiness. – heynnema Mar 15 '20 at 18:13
  • @SergioLeone Your wireless connection is too bad... "Link Quality=45/70 Signal level=-65 dBm". Move closer to your router. – heynnema Mar 15 '20 at 18:15
  • Yes, I know it's not good... Unfortunately I can't move closer. But can that be the cause of bad system performance? – SergioLeone Mar 15 '20 at 18:21
  • @SergioLeone Yes. "Tx excessive retries:7 Invalid misc:113". Your 16G swap is excessive, but that's not the problem. Temporarily try this... sudo sysctl vm.swappiness=60 and retest. – heynnema Mar 15 '20 at 18:23
  • Still seeing freezes now and then. – SergioLeone Mar 15 '20 at 18:47
  • @SergioLeone Until you can test with a better wifi connection, we won't get much farther. Go down to a public wifi, hope to get a better signal, and retry. Report back. – heynnema Mar 15 '20 at 19:12
  • @SergioLeone Do you have QoS enabled in your router? – heynnema Mar 15 '20 at 20:16
  • I'm not sure @heynnema, the router is controlled by the home owner from whom I'm renting, so I can't really do anything to improve the connection or even check the settings. Anyways, thanks for your help. Will accept your answer as this at least got me a bit further into investigating this. – SergioLeone Mar 16 '20 at 09:11
  • @SergioLeone Fair enough. Just ask the home owner if QoS is enabled or disabled :-) – heynnema Mar 16 '20 at 14:34
0

I have the same issue. Turn on Airplane mode and reactivate wifi. That worked for me.