Fix the slow laptop after suspend issue on Ubuntu / Mint
Since this winter, I’m a happy user of Linux Mint, a distribution made on top of Ubuntu with a better user experience and a faster release cycle, which means more recent software.
I run it on a DELL Latitude E6520 with 227Gb SSD drive, quad core Intel i7–2640M CPU
@ 2.80GHz and 8Gb of RAM: needless to say I expect some serious
performances all the time even with a shitload of services running
like Elasticsearch, RabbitMQ, Apache, PHP-FPM, Postgre, Mysql, Vagrant…
Most of the time it was fine, but sometimes after a suspend (closing the lid, riding back home and opening it back) the whole experience was ruined:
- Switch tabs in Chromium was slow;
- Some heavy webapps were unusable (Slack i.e.);
- Clicking anywhere was painful, feeling like 0,5s delay everywhere.
There was no known or logical reasons for this issue, and we can find some old bug reports all over the web with no clues. Also, it’s very hard to describe a bug when it’s only a feeling: at the end everything works, there is no crash, it just feel slow.
A good way to monitor a Unix system performances is glxgears.
Using this command: vblank_mode=0 glxgears
I was able to see what I was feeling.
# After booting 39651 frames in 5.0 seconds = 7930.121 FPS # After some time... 10859 frames in 5.0 seconds = 2171.632 FPS
After some digging, I discovered the cpufreq-info command and the output unveiled the culprit:
Report errors and bugs to cpufreq@vger.kernel.org, please. analyzing CPU 0: driver: acpi-cpufreq CPUs which run at the same hardware frequency: 0 CPUs which need to have their frequency coordinated by software: 0 maximum transition latency: 10.0 us. hardware limits: 800 MHz - 2.80 GHz available frequency steps: 2.80 GHz, 2.80 GHz, 2.60 GHz, 2.40 GHz, 2.20 GHz, 2.00 GHz, 1.80 GHz, 1.60 GHz, 1.40 GHz, 1.20 GHz, 1000 MHz, 800 MHz available cpufreq governors: conservative, ondemand, userspace, powersave, performance current policy: frequency should be within 800 MHz and 2.80 GHz. The governor "ondemand" may decide which speed to use within this range. current CPU frequency is 800 MHz. cpufreq stats: 2.80 GHz:0,00%, 2.80 GHz:0,00%, 2.60 GHz:0,00%, 2.40 GHz:0,00%, 2.20 GHz:0,00%, 2.00 GHz:0,00%, 1.80 GHz:0,00%, 1.60 GHz:0,00%, 1.40 GHz:0,00%, 1.20 GHz:0,00%, 1000 MHz:0,00%, 800 MHz:100,00% (240494)
We can see that my CPU frequency is 800 MHz and that the governor is ondemand, but when I run something CPU intensive, the frequency is never increased. Here is the issue.
My solution was to install indicator-cpufreq, a nice applet allowing to see and control the CPU frequencies, overriding the governor requests.
No more reboot for me \o/