Skip to content

Instantly share code, notes, and snippets.

@edcote
Last active February 28, 2023 20:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edcote/92b25508c7d93bb7cb7200e517dbb4f3 to your computer and use it in GitHub Desktop.
Save edcote/92b25508c7d93bb7cb7200e517dbb4f3 to your computer and use it in GitHub Desktop.
Linux CPU throttle and I/O performance tips

CPU performance

My workstation's CPU has been throttling and/or running slow for the past 48 hours. Here are the commands that I used to debug the problem.

First, core temperatues were checked:

$ watch sensors
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0:  +33.0°C  (high = +80.0°C, crit = +100.0°C)
Core 0:         +28.0°C  (high = +80.0°C, crit = +100.0°C)
Core 1:         +29.0°C  (high = +80.0°C, crit = +100.0°C)
Core 2:         +33.0°C  (high = +80.0°C, crit = +100.0°C)
Core 3:         +30.0°C  (high = +80.0°C, crit = +100.0°C)

... but thes CPU are running at a reduced speed:

$ grep -E '^model name|^cpu MHz' /proc/cpuinfo
model name	: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
cpu MHz		: 1700.156
model name	: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
cpu MHz		: 1761.406
model name	: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
[..]

(this didn't work) The solution I chose was to disable pstate driver altogher. I added kernel option intel_pstate=disable to /etc/default/grub, variable GRUB_CMDLINE_LINUX. Then, ran grub2-mkconfig, followed by a reboot.

CPU are not throttling, but do not boost. It is an adequate solution for now.

Here is another solution.

for G in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
    echo -n performance > $G
    cat $G
done

I/O scheduling

What I/O schedules is my system using?

% for x in /sys/block/*/queue/scheduler; do echo $x; cat $x; done

/sys/block/md127/queue/scheduler
none
/sys/block/sda/queue/scheduler
noop deadline [cfq] 
[..]

I decided to change to deadline schedule with hope for less UI hangs: grubby --update-kernel=ALL --args="elevator=deadline"

SDD Performance

  • General drive info: sudo hdparm -I /dev/sdd

  • SMART error log: smartctl --all /dev/sdd

More info: https://www.cyberciti.biz/tips/linux-find-out-if-harddisk-failing.html

  • Trace IO processes: `sudo iotop -obtqqq | grep jbd2"

  • Why is Kworker taking 99.99%

sudo perf record -g -a sleep 10
sudo perf report

https://askubuntu.com/questions/33640/kworker-what-is-it-and-why-is-it-hogging-so-much-cpu/422151#422151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment