CPU usage too high on Ubuntu 20.10

It's been some days since everything got slowed down on my Dell Latitude 5480. I have 16GB RAM, rarely its usage goes beyond 40%, but applications that normally don't use that much CPU now they go up to 100%, especially videos. I tried switching from Firefox to Chromium, I disabled GPU acceleration on Firefox, to no avail. On those cases, top would show Firefox or Chromium as culprits, but in the Firefox tasks console there's nothing wrong, no tab is especially taking too much CPU in Firefox's opinion. I would like to stress that this wasn't happening at all some days ago. Here is some information that @heynnema requested on a similar case (Ubuntu 20.04 slows down after usage): https://paste.ubuntu.com/p/qpFg8gkV8f/

$ top

top - 20:54:37 up 3 min,  1 user,  load average: 6,82, 3,20, 1,26
Tasks: 254 total,   3 running, 251 sleeping,   0 stopped,   0 zombie
%Cpu(s): 75,5 us, 23,5 sy,  0,0 ni,  1,0 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
MiB Mem :  15871,7 total,  11662,1 free,   2618,7 used,   1590,9 buff/cache
MiB Swap:  30518,0 total,  30518,0 free,      0,0 used.  12718,8 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                        
   2153 leandro   20   0 3692108 551256 171408 R 170,0   3,4   2:58.64 firefox                                                                        
   2701 leandro   20   0 2845060 376568 176988 R  75,0   2,3   0:44.78 Web Content                                                                    
   2432 leandro   20   0   26,9g 571352  98404 S  45,0   3,5   1:04.69 WebExtensions                                                                  
   2825 leandro   20   0  218560  58392  42652 S  20,0   0,4   0:01.66 RDD Process                                                                    
   2902 leandro   20   0   21524   4312   3512 R  20,0   0,0   0:00.08 top                                                                            
   2275 leandro   20   0 2711824 302536 103468 S  15,0   1,9   0:45.91 Web Content                                                                    
   1655 leandro   20   0  862908  73856  49624 S  10,0   0,5   0:14.60 Xorg                                                                           
   1856 leandro   20   0 4007508 267416 103672 S  10,0   1,6   0:35.87 gnome-shell                                                                    
   2504 leandro   20   0 2486004 157748 100972 S  10,0   1,0   0:06.86 Web Content                                                                    
   2213 leandro   20   0 2523948 177836 108792 S   5,0   1,1   0:13.12 Web Content                                                                    
   2331 leandro   20   0  835556  62888  40308 S   5,0   0,4   0:04.37 terminator                                                                     
      1 root      20   0  169312  12420   8652 S   0,0   0,1   0:03.93 systemd                                                                        
      2 root      20   0       0      0      0 S   0,0   0,0   0:00.00 kthreadd                                                                       
      3 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 rcu_gp                                                                         
      4 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 rcu_par_gp                                                                     
      5 root      20   0       0      0      0 I   0,0   0,0   0:00.00 kworker/0:0-events                                                             
      6 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 kworker/0:0H-kblockd                                                           
      7 root      20   0       0      0      0 I   0,0   0,0   0:00.00 kworker/0:1-events                                                             
      8 root      20   0       0      0      0 I   0,0   0,0   0:00.14 kworker/u8:0-ext4-rsv-conversion                                               
      9 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 mm_percpu_wq                                                                   
     10 root      20   0       0      0      0 S   0,0   0,0   0:00.07 ksoftirqd/0                                                                    
     11 root      20   0       0      0      0 I   0,0   0,0   0:00.65 rcu_sched                                                                      
     12 root      rt   0       0      0      0 S   0,0   0,0   0:00.00 migration/0                                                                    
     13 root     -51   0       0      0      0 S   0,0   0,0   0:00.00 idle_inject/0                                                                  
     14 root      20   0       0      0      0 S   0,0   0,0   0:00.00 cpuhp/0                                                                        
     15 root      20   0       0      0      0 S   0,0   0,0   0:00.00 cpuhp/1                                                                        
     16 root     -51   0       0      0      0 S   0,0   0,0   0:00.00 idle_inject/1                                                                  
     17 root      rt   0       0      0      0 S   0,0   0,0   0:00.21 migration/1                                                                    
     18 root      20   0       0      0      0 S   0,0   0,0   0:00.08 ksoftirqd/1                                                                    
     19 root      20   0       0      0      0 I   0,0   0,0   0:00.01 kworker/1:0-events                                                             
     20 root       0 -20       0      0      0 I   0,0   0,0   0:00.00 kworker/1:0H-kblockd                                                           
     21 root      20   0       0      0      0 S   0,0   0,0   0:00.00 cpuhp/2       

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       2,4Gi        11Gi       206Mi       1,5Gi        12Gi
Swap:          29Gi          0B        29Gi


$ sudo turbostat --Summary --show Busy%,Bzy_MHz,IRQ,PkgWatt,PkgTmp,RAMWatt,GFXWatt --interval 15
turbostat version 20.03.20 - Len Brown <[email protected]>
CPUID(0): GenuineIntel 0x16 CPUID levels; 0x80000008 xlevels; family:model:stepping 0x6:8e:9 (6:142:9)
CPUID(1): SSE3 MONITOR SMX EIST TM2 TSC MSR ACPI-TM HT TM
CPUID(6): APERF, TURBO, DTS, PTM, HWP, HWPnotify, HWPwindow, HWPepp, No-HWPpkg, EPB
cpu2: MSR_IA32_MISC_ENABLE: 0x00850089 (TCC EIST MWAIT PREFETCH TURBO)
CPUID(7): SGX
cpu2: MSR_IA32_FEATURE_CONTROL: 0x00000005 (Locked )
CPUID(0x15): eax_crystal: 2 ebx_tsc: 226 ecx_crystal_hz: 0
TSC: 2712 MHz (24000000 Hz * 226 / 2 / 1000000)
CPUID(0x16): base_mhz: 2700 max_mhz: 3500 bus_mhz: 100
cpu2: MSR_MISC_PWR_MGMT: 0x00401cc0 (ENable-EIST_Coordination DISable-EPB DISable-OOB)
RAPL: 17476 sec. Joule Counter Range, at 15 Watts
cpu2: MSR_PLATFORM_INFO: 0x804043df1011b00
4 * 100.0 = 400.0 MHz max efficiency frequency
27 * 100.0 = 2700.0 MHz base frequency
cpu2: MSR_IA32_POWER_CTL: 0x0024005d (C1E auto-promotion: DISabled)
cpu2: MSR_TURBO_RATIO_LIMIT: 0x23232323
35 * 100.0 = 3500.0 MHz max turbo 4 active cores
35 * 100.0 = 3500.0 MHz max turbo 3 active cores
35 * 100.0 = 3500.0 MHz max turbo 2 active cores
35 * 100.0 = 3500.0 MHz max turbo 1 active cores
cpu2: MSR_CONFIG_TDP_NOMINAL: 0x0000001a (base_ratio=26)
cpu2: MSR_CONFIG_TDP_LEVEL_1: 0x0008003c (PKG_MIN_PWR_LVL1=0 PKG_MAX_PWR_LVL1=0 LVL1_RATIO=8 PKG_TDP_LVL1=60)
cpu2: MSR_CONFIG_TDP_LEVEL_2: 0x001b00c8 (PKG_MIN_PWR_LVL2=0 PKG_MAX_PWR_LVL2=0 LVL2_RATIO=27 PKG_TDP_LVL2=200)
cpu2: MSR_CONFIG_TDP_CONTROL: 0x00000000 ( lock=0)
cpu2: MSR_TURBO_ACTIVATION_RATIO: 0x00000017 (MAX_NON_TURBO_RATIO=23 lock=0)
cpu2: MSR_PKG_CST_CONFIG_CONTROL: 0x1e008008 (UNdemote-C3, UNdemote-C1, demote-C3, demote-C1, locked, pkg-cstate-limit=8 (unlimited))
cpu2: cpufreq driver: intel_pstate
cpu2: cpufreq governor: powersave
cpufreq intel_pstate no_turbo: 0
cpu2: MSR_MISC_FEATURE_CONTROL: 0x00000000 (L2-Prefetch L2-Prefetch-pair L1-Prefetch L1-IP-Prefetch)
cpu0: MSR_PM_ENABLE: 0x00000001 (HWP)
cpu0: MSR_HWP_CAPABILITIES: 0x01081a23 (high 35 guar 26 eff 8 low 1)
cpu0: MSR_HWP_REQUEST: 0x80002304 (min 4 max 35 des 0 epp 0x80 window 0x0 pkg 0x0)
cpu0: MSR_HWP_INTERRUPT: 0x00000000 (Dis_Guaranteed_Perf_Change, Dis_Excursion_Min)
cpu0: MSR_HWP_STATUS: 0x00000000 (No-Guaranteed_Perf_Change, No-Excursion_Min)
cpu0: MSR_IA32_ENERGY_PERF_BIAS: 0x00000006 (balanced)
cpu0: MSR_RAPL_POWER_UNIT: 0x000a0e03 (0.125000 Watts, 0.000061 Joules, 0.000977 sec.)
cpu0: MSR_PKG_POWER_INFO: 0x00000078 (15 W TDP, RAPL 0 - 0 W, 0.000000 sec.)
cpu0: MSR_PKG_POWER_LIMIT: 0x4280c800dd8078 (UNlocked)
cpu0: PKG Limit #1: ENabled (15.000000 Watts, 28.000000 sec, clamp ENabled)
cpu0: PKG Limit #2: ENabled (25.000000 Watts, 0.002441* sec, clamp DISabled)
cpu0: MSR_DRAM_POWER_LIMIT: 0x5400de00000000 (UNlocked)
cpu0: DRAM Limit: DISabled (0.000000 Watts, 0.000977 sec, clamp DISabled)
cpu0: MSR_PP0_POLICY: 0
cpu0: MSR_PP0_POWER_LIMIT: 0x00000000 (UNlocked)
cpu0: Cores Limit: DISabled (0.000000 Watts, 0.000977 sec, clamp DISabled)
cpu0: MSR_PP1_POLICY: 0
cpu0: MSR_PP1_POWER_LIMIT: 0x00000000 (UNlocked)
cpu0: GFX Limit: DISabled (0.000000 Watts, 0.000977 sec, clamp DISabled)
cpu0: MSR_IA32_TEMPERATURE_TARGET: 0x02640000 (100 C)
cpu0: MSR_IA32_PACKAGE_THERM_STATUS: 0x883a0008 (42 C)
cpu0: MSR_IA32_PACKAGE_THERM_INTERRUPT: 0x00000003 (100 C, 100 C)
cpu2: MSR_PKGC3_IRTL: 0x0000884e (valid, 79872 ns)
cpu2: MSR_PKGC6_IRTL: 0x00008876 (valid, 120832 ns)
cpu2: MSR_PKGC7_IRTL: 0x00008894 (valid, 151552 ns)
cpu2: MSR_PKGC8_IRTL: 0x000088fa (valid, 256000 ns)
cpu2: MSR_PKGC9_IRTL: 0x0000894c (valid, 339968 ns)
cpu2: MSR_PKGC10_IRTL: 0x00008bf2 (valid, 1034240 ns)
Busy%   Bzy_MHz IRQ PkgTmp  PkgWatt GFXWatt RAMWatt
81.37   628 120145  42  1.86    0.08    0.53
78.13   615 124712  42  1.77    0.07    0.51
49.01   637 80666   41  1.45    0.04    0.36

$ sudo dmidecode -s bios-version
1.17.1

$ swapon -s
Filename                Type        Size    Used    Priority
/dev/sda3                               partition   31250428    0   -2

$ grep -i swap /etc/fstab
# swap was on /dev/sda3 during installation
UUID=174e804f-da04-4503-81f9-999b012324a1 none            swap    sw              0       0

$ sysctl vm.swappiness
vm.swappiness = 60

Solution 1:

Power Manager

Due to battery/power issues...

With the computer shut down, hold down the POWER key for ~30 seconds. This will reset the Power Manager. See if there's any operational improvement.

BIOS

Dell Latitude 5480

You have BIOS version 1.17.1, dated 1/7/2020. There's a newer BIOS available, version 1.19.2, dated 5/4/2021, and can be downloaded here.

Note: Confirm that I have the correct web page for your model #.

Note: Have good backups before updating the BIOS.

SWAP

30G swap is nuts. Assuming that you're using a /swapfile, and not a disk partition, and not hibernating, we'll reduce the /swapfile to 4G.


Update: You're using /dev/sda3 as a swap partition. We can still create a 4G /swapfile using the procedure below, and then use gparted to delete /dev/sda3. Only do this if you are NOT hibernating. Also comment out the following line in /etc/fstab...

UUID=174e804f-da04-4503-81f9-999b012324a1 none            swap    sw              0       0

Note: Incorrect use of the rm and dd commands can cause data loss. Suggest copy/paste.

In the terminal...

sudo swapoff -a           # turn off swap
sudo rm -i /swapfile      # remove old /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

sudo chmod 600 /swapfile  # set proper file protections
sudo mkswap /swapfile     # init /swapfile
sudo swapon /swapfile     # turn on swap
free -h                   # confirm 16G RAM and 4G swap

Edit /etc/fstab, using sudo -H gedit /etc/fstab or sudo pico /etc/fstab.

Confirm this /swapfile line in /etc/fstab... and confirm no other “swap” lines... use SPACES in this line... confirm NO TABS...

/swapfile  none  swap  sw  0  0

reboot                    # reboot and verify operation

vm.swappiness

Your vm.swappiness currently is set at the default of 60.

edits forthcoming...

gnome-shell

Go to https://extensions.gnome.org/local/ and temporarily disable the disable-gestures and system-monitor gnome-shell extensions, then restart gnome-shell or reboot. See if things improve.

Firefox

edits forthcoming...