What should VM writeback timeout be set to for a laptop?
Solution 1
The larger the dirty writeback setting the longer dirty pages sit in memory before being flushed out to disk. The downside is that this increases the window of opportunity for losing data if you lose power since there will be probably more dirty pages sitting in memory and not flushed out.
Solution 2
Actually you don't need to set dirty_writeback timeout to more than 6000 centisec, but rather to less. At least for Powertop to smile: It seems Powertop checks for vm.dirty_writeback = an *exact* value of 1500 csec (15 sec)
. You can check by setting it to this value and look back at the powertop screen.
Other than that, @Colin Ian King said it clear on the data loss widening window with higher timeouts.
Solution 3
I believe a larger value means to wait longer between writes (which means spinning up the drive less frequently)
No, you're just delaying write operations to the disk by 10 minutes. This doesn't buy you anything in terms of battery life or reducing SSD writes.
The way to think about this value is: "What's the longest ever possible time (times 2, even) that I would ever want a batch of disk operations to last."
If you have an application that actually takes 10 minutes (an absurdly high value for normal users) of disk writes that would benefit of being delayed in I/O, eg. multiple writes to the same file get made into one write, then you would set the timeout to a very high value.
tldr; For 99.9% of users, the powertop suggested default is more than enough.
If you actually want to reduce writes to SSD, think about putting parts of your filesystem on tmpfs. But that's a whole other subject.
Comments
-
Chas. Owens over 1 year
I am using
powertop
to check that my machine is setup in a way that will give me good battery life. After installinglaptop-mode-tools
all of the "Tunables" section shows "Good" except VM writeback timeout. On thepowertop
page, it seems to suggest that 1500 (i.e. 15 seconds) is a good value. Checkingcat /proc/sys/vm/dirty_writeback_centisecs
shows that my current value is 60000 (i.e. 600 seconds or 10 minutes). I believe a larger value means to wait longer between writes (which means spinning up the drive less frequently). Do I really need to set the timeout longer than ten minutes?-
geethujoseph over 11 yearsJust a note: you can configure those values in
/etc/laptop-mode/laptop-mode.conf
(LM_BATT_MAX_LOST_WORK_SECONDS
). Personally i think 10 minutes is too much (i use 20 seconds). -
unhammer about 10 yearsYou should also be able to put
vm.dirty_writeback_centisecs=1500
in/etc/sysctl.d/99-vm-writeback.conf
and reboot or dosudo service procps start
-
-
tuk0z over 5 yearsThank you @Catskul for being more specific than I had it. It's appreciated :)