Cinnamon desktop lagging, spiking CPU every other second

Lately my Cinnamon desktop environment (running on Linux Mint 18.2) has been a bit… laggy. Mouse movement is 100% fine; however every scrolling, window-moving, highlighting, video playing (as it seems to me, things that update window content) causes 100% CPU spikes on one core for half a second, repeating with 1-2 sec period, freezing whatever I was doing. Disk usage stays low during it. This also causes videos to desynchronize with their sound. Needless to say, it’s extremely annoying. Between the lags it works as it should.

My computer should handle Cinnamon well – Linux is installed on an SSD (though some directories, like ~HOME, are on an HDD), I have 4GB RAM and an i5 3.2gHz CPU, and running from a Raedon 5770 GPU (built-in driver). My inxi tells:

ezio@Cantabury ~/Downloads $ inxi -F
System:    Host: Cantabury Kernel: 4.10.0-32-generic x86_64 (64 bit) Desktop: Cinnamon 3.4.6
           Distro: Linux Mint 18.2 Sonya
Machine:   Mobo: ASRock model: H87M Pro4 Bios: American Megatrends v: P2.00 date: 12/06/2013
CPU:       Quad core Intel Core i5-4440 (-MCP-) cache: 6144 KB 
           clock speeds: max: 3300 MHz 1: 2711 MHz 2: 2599 MHz 3: 2692 MHz 4: 2573 MHz
Graphics:  Card: Advanced Micro Devices [AMD/ATI] Juniper XT [Radeon HD 5770]
           Display Server: X.Org 1.18.4 drivers: ati,radeon (unloaded: fbdev,vesa)
           Resolution: 1920x1080@60.00hz
           GLX Renderer: Gallium 0.4 on AMD JUNIPER (DRM 2.49.0 / 4.10.0-32-generic, LLVM 4.0.0)
           GLX Version: 3.0 Mesa 17.0.7
Audio:     Card-1 Intel 8 Series/C220 Series High Definition Audio Controller driver: snd_hda_intel
           Card-2 Advanced Micro Devices [AMD/ATI] Juniper HDMI Audio [Radeon HD 5700 Series]
           driver: snd_hda_intel
           Sound: Advanced Linux Sound Architecture v: k4.10.0-32-generic
Network:   Card: Intel Ethernet Connection I217-V driver: e1000e
           IF: enp0s25 state: up speed: 1000 Mbps duplex: full mac: bc:5f:f4:ab:e1:39
Drives:    HDD Total Size: 1901.6GB (1.6% used) ID-1: /dev/sda model: Samsung_SSD_840 size: 120.0GB
           ID-2: /dev/sdb model: WDC_WD10EZEX size: 1000.2GB
           ID-3: /dev/sdc model: SAMSUNG_HD753LJ size: 750.2GB
           ID-4: USB /dev/sdd model: Storage_Device size: 31.2GB
Partition: ID-1: / size: 20G used: 9.5G (52%) fs: ext4 dev: /dev/sda3
           ID-2: /home size: 46G used: 6.4G (15%) fs: ext4 dev: /dev/sdb3
           ID-3: swap-1 size: 4.09GB used: 0.19GB (5%) fs: swap dev: /dev/sdb5
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 38.0C mobo: N/A gpu: 37.0
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 226 Uptime: 15:19 Memory: 2554.5/3866.3MB Client: Shell (bash) inxi: 2.2.35 

Apparently, it’s Cinnamon itself. It’s a bit hard to capture the spike while also causing it, but Cinnamon’s CPU usage increases to 40-60% during them, while no other process changes.

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND               
 1719 ezio      20   0 2587952 600112  50384 S  16,3 15,2 137:58.43 cinnamon              
  983 root      20   0  283508   7944   5652 S   1,7  0,2  18:45.15 polkitd               
19103 ezio      20   0 3388232 787320 148876 S   1,7 19,9  16:42.69 Web Content           
 1259 root      20   0  477696 128816  95528 S   1,0  3,3   9:09.57 Xorg                  
  798 message+  20   0   44196   4416   3128 S   0,7  0,1   7:41.66 dbus-daemon           
  840 root      20   0  450548  11984  10408 S   0,7  0,3   8:10.89 NetworkManager        
25137 ezio      20   0  499564  40600  24392 S   0,7  1,0   0:08.13 gnome-terminal-       
19052 ezio      20   0 3090968 688212 189464 S   0,3 17,4  14:53.08 firefox   

What could be the solution?

Edit: In my journalct -e output, three lines caught my unprofesional eye:

Aug 30 19:17:01 Cantabury CRON[18289]: pam_unix(cron:session): session closed for user root
Aug 30 19:20:37 Cantabury cinnamon-screensaver-pam-helper[18398]: pam_ecryptfs: seteuid error
Aug 30 19:20:37 Cantabury cinnamon-screensaver-pam-helper[18398]: gkr-pam: the password for the login keyring was invalid.

Now that I see this, I recall gettingt a prompt several times complaining about the login keyring, asking for a password. I didn’t know that password (it wasn’t my user pw == the root pw), so just minimized/closed it.

Asked By: Neinstein

||

I asked this question first on the Linux Mint Forum, where mr_raider provided the solution.
All credits go to him.

The problem was caused by the default AMD drivers. The solution is installing an updated version, the oibaf AMD drivers. The procedure:

sudo add-apt-repository ppa:oibaf/graphics-drivers
sudo apt update
sudo apt upgrade

After this and a reboot, the lag is no more.

The forum thread is available there:
[SOLVED] Cinnamon lagging, causing CPU spikes every other second

Answered By: Neinstein

I also had this problem after updating to Mint 18.3

I have NVidia, and tried updating my drivers, but it didn’t help. For me it was the new driver (in my case 340.106) that was the problem.

Once I reverted to 340.104 everything seems to be amazing again.

I just wanted to post unless anyone else is having the same issue.

Thanks

Answered By: Uncle Snail

You can also try logging out and logging in with Software Rendering disabled.

Answered By: swapyonubuntu

What worked for me (Nvidia) was going into my misc settings and disabling Vscync. fixing the screen tearing is easy. open the nvidia control panel. Display config. Show advanced and force full rendering pipeline. do this for all your monitors. made it super smooth

Answered By: cardcraft
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.