fstrim slows down mixed ssd/hdd considerable
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
util-linux (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
I have a ssd/hdd system where the ssd is used for the system and most of home is on a large hdd.
I noticed that the weekly fstrim cron job slows the system down considerable, including e.g. firefox and
the desktop. iotop reports:
"""
otal DISK READ : 0.00 B/s | Total DISK WRITE : 0.00 B/s
Actual DISK READ: 0.00 B/s | Actual DISK WRITE: 7.71 K/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
24504 be/4 root 0.00 B/s 0.00 B/s 0.00 % 99.99 % fstrim --all
"""
So hardly any real io activity but still massive slowdown with 3.16.0-24-generic.
E.g. a dpkg operation while fstrim is running:
"""
# time dpkg -i 2vcard_
real 0m8.221s
user 0m0.895s
sys 0m0.671s
# time dpkg -i 2vcard_
real 0m8.215s
user 0m0.895s
sys 0m0.705s
# killall fstrim
# time dpkg -i 2vcard_
real 0m2.023s
user 0m0.992s
sys 0m0.703s
# time dpkg -i 2vcard_
real 0m1.709s
user 0m0.958s
sys 0m0.738s
"""
This may of course be simply a kernel problem but I do get similar result for both 3.16 and 3.13.
It's not really that surprising -- it needs to iterate over the mounts, find free blocks, and tell the disk controller to trim them; on a developer machine where there is usually a lot of data turnaround over a week, this usually has to process dozens of GB.