System freezes : I/O Scheduler issues ???
Hi fellow Archers !
I've got an issue on my main build (Ryzen, built 2 years ago). It does that since I installed Arch on it but it starts to really annoy me...
Whenever I copy a large amount of data (the number of files don't seems to affect how the issue behaves), the whole system can freeze a few seconds and then reacts normally just to start again a few seconds later. It's really annoying as I cannot do something else when copying large amount of data (+50GB), which I need to do regularly... It also happens when I do HDD intense tasks : once I needed to compress the whole hard drive to get some free space end even there it froze and it was very annoying because I couldn't use my PC for a whole day.
Here are the installed hard drives (edited fstab copy) :
# nvme0n1 ---> NVMe SSD 256GB
# sda ---> Unmounted 1TB HDD
# sdb ---> 2TB HDD
# sdc ---> 3TB HDD
# /dev/nvme0n1p2 LABEL=root
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX /
f2fs
rw,relatime,lazytime,background_gc=on,discard,no_heap,inline_xattr,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6,alloc_mode=default,fsync_mode=posix 0 0
# /dev/nvme0n1p1 LABEL=boot
UUID=XXXX-XXXX /boot
vfat
rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 2
# /dev/sdc3 LABEL=home
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX /home
btrfs
rw,relatime,space_cache,autodefrag,compress=zstd,subvolid=5,subvol=/ 0 0
# /dev/sdb1 LABEL=toshiba-home
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX /home/lucile-alice/toshiba-home
btrfs
rw,relatime,space_cache,autodefrag,subvolid=5,subvol=/ 0 0
# /dev/sdc1 LABEL=swap
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX none
swap
defaults 0 0
I'm using the old, boring, regular Arch kernel (ver. 5.4.13).
The system was completely wiped and reinstalled after some mistakes I did (basically nuked my root partition lol).
My 3Tb HDD is known to be very slow (80MB/s read, 60MB/s write) for a SATAIII drive. Just because of it, my boot time is delayed by approximately 10s every boot, despite having a SSD as the main drive (it takes +10s to mount /home). But this is not the main issue here but can be the cause of the problem above, because it is my main storage drive and is where the files often come from when I copy.
I also tested the HDD health : SMART is okay and I run a whole HDD Regenerator on it and there was no dead sectors or delays... It's just a god damn slow drive.
None of my other PCs does those freezes, except a old laptop when it compiles (can also be a HDD issue or a slow CPU btw).
A friend of mine told me that it can be related to the IO scheduler but I don't have the issue elsewhere and I always used the default settings for that. He doesn't have this issue either and I followed how he installs Arch and he almost do the same things as me (some packages differ, that's quite it). But this is also the one and only Arch setup I've seen/owned where the main drive is a NVMe SSD, but I already used some SATAIII SSDs with the root formatted in F2FS and these don't seem to have the issue.
I've run interbench to check the system latencies but I don't know how to interpret the results :
2971488 loops_per_ms read from file interbench.loops_per_ms
Creating file for read load...
Using 2971488 loops per ms, running every load for 30 seconds
Benchmarking kernel 5.4.13-arch1-1 at datestamp 202001210854
--- Benchmarking simulated cpu of Audio in the presence of simulated ---
Load Latency +/- SD (ms) Max Latency % Desired CPU % Deadlines Met
None 0.1 +/- 0.1 0.6 100 100
Video 0.1 +/- 0.2 0.6 100 100
X 0.1 +/- 0.1 0.6 100 100
Burn 0.0 +/- 0.0 0.8 100 100
Write 0.2 +/- 1.5 21.7 100 100
Read 0.1 +/- 0.1 0.6 100 100
Compile 1.2 +/- 4.6 50.0 100 99.8
Memload 0.1 +/- 0.1 0.5 100 100
--- Benchmarking simulated cpu of Video in the presence of simulated ---
Load Latency +/- SD (ms) Max Latency % Desired CPU % Deadlines Met
None 0.5 +/- 2.6 17.0 100 97.7
X 0.2 +/- 0.8 17.0 100 99.8
Burn 16.7 +/- 16.7 16.7 100 0.111
Write 3.4 +/- 8.4 47.4 98 82.5
Read 0.1 +/- 1.4 17.6 100 99.3
Compile 18.4 +/- 21.1 79.2 79.3 7.23
Memload 0.3 +/- 0.9 17.0 100 99.7
--- Benchmarking simulated cpu of X in the presence of simulated ---
Load Latency +/- SD (ms) Max Latency % Desired CPU % Deadlines Met
None 10.6 +/- 20.7 54.0 42.8 32.8
Video 11.4 +/- 21.9 62.0 42 31.9
Burn 68.8 +/- 94.1 205.0 16.5 6.66
Write 21.2 +/- 38.4 128.0 31.2 20.9
Read 12.6 +/- 24.1 72.0 39.9 30.1
Compile 75.6 +/- 103.9 274.0 15 5.7
Memload 10.6 +/- 20.9 57.0 42.2 32.4
--- Benchmarking simulated cpu of Gaming in the presence of simulated ---
Load Latency +/- SD (ms) Max Latency % Desired CPU
None 0.0 +/- 0.0 0.0 100
Video 0.1 +/- 1.1 21.4 99.9
X 0.0 +/- 0.7 13.8 100
Burn 53.1 +/- 53.3 53.5 65.3
Write 4.9 +/- 11.4 71.4 95.3
Read 0.0 +/- 0.0 0.3 100
Compile 49.7 +/- 57.9 179.5 66.8
Memload 0.1 +/- 1.5 28.5 99.9
Thanks for reading this awful pile of text.
About this post
- Posted
- Archived
- Score
- 10 · 100% up
- Kind
- Text
- ID
- ers6ko
8 comments
Not a clue, but try noatime instead of relatime for starters:
Why I experience poor performance during file access on filesystem?
By default the file system is mounted with relatime flag, which means it must update files' metadata during first access on each day. Since updates to metadata are done as COW, if one visits a lot o files, it results in massive and scattered write operations on the underlying media.
You need to mount file system with noatime flag to prevent this from happening.
More details are in Mount_options#Performance
This and you don't want to do relatime on an nvme/ssd. Neither should you manually discard, instead enable fstrim.timer
My SSD partitions are in F2FS and are correctly set.
The issue seems to occur only on my 3TB drive.
Also, I did the changes stated above and it made my system unable to boot because it cannot mount /home...
I have a similar issue. While you are copying your large files, start the top command at the same time, and look at the buff/cache and used swap space. If you are seeing your buff/cache value increasing AND your swap space usage also increasing a lot, then it might be the same problem. It seems that recent kernels (> 5.3) prefer to keep io cache and start swapping a lot of processes. And this is still happening even with vm.swappiness=1
can you downgrade to a 5.2 kernel ? see also this thread https://forum.manjaro.org/t/kernel-5-3-more-prone-to-swapping-than-5-2-and-earlier/107972
I had this issue since I first installed Arch on this machine, almost 2 years ago. The 5.0 kernel was not even out yet. I doubt it's my issue even if it can slow my system even more...
Deleted before we saved it.
i/o hangs used to be common and most common cause for system freeze aside from lack of disk space.. in my experience. haven't had those freezes in a while (late 2018 - 2020).
Install linux-ck follow the arch wiki on setting udev rules for spinning media and run swap on the nvme not on the HDD.. Also set up fstrim by enabling the systemd timer.
Also look at bcache to merge all that with the nvme acting as cache