11

I am using powertop to check that my machine is setup in a way that will give me good battery life. After installing laptop-mode-tools all of the "Tunables" section shows "Good" except VM writeback timeout. On the powertop page, it seems to suggest that 1500 (i.e. 15 seconds) is a good value. Checking cat /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?

  • Just 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). – Salem Sep 24 '12 at 21:40
  • You should also be able to put vm.dirty_writeback_centisecs=1500 in /etc/sysctl.d/99-vm-writeback.conf and reboot or do sudo service procps start – unhammer Mar 20 '14 at 7:04
6

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.

| improve this answer | |
5

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.

| improve this answer | |
  • Thank you @Catskul for being more specific than I had it. It's appreciated :) – tuk0z Jan 1 '19 at 10:03
0

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.