You are not logged in.

#1 2013-09-05 03:18:33

LeftyAce
Member
Registered: 2012-08-18
Posts: 93

disk still wakes up with laptop-mode-tools

Hi all,

I have a Thinkpad x61 and I'm trying to manage power use with laptop-mode-tools, but I'm having trouble with the harddrive waking up too much. I have it configured so that lm-tools activates when the power is disconnected, and sure enough, a few seconds later the harddrive spins down. But 1-2 seconds later it spins back up! iotop indicates that dhcpcd is writing to the drive, and thus waking it up.

I thought lm-tools was set so that I could "potentially lose up to 10 minutes of work." Shouldn't that mean that up to 10 minutes of writes get buffered in ram instead of waking up the harddrive? If I disable the network, dhcpcd stops waking things up, but if I save a buffer from emacs, the harddrive instantly wakes up, so it looks like there's no buffering going on...

Here are some relevant settings while in laptop-mode:

$ dmesg|tail
[15425.800826] EXT4-fs (sda1): re-mounted. Opts: data=ordered,commit=600
[15425.982220] EXT4-fs (sda2): re-mounted. Opts: data=ordered,commit=600

$ cat /proc/sys/vm/dirty_writeback_centisecs 
60000
$ cat /proc/sys/vm/dirty_expire_centisecs 
60000
$ cat /proc/sys/vm/dirty_bytes 
0
$ cat /proc/sys/vm/dirty_background_bytes 
0
$ cat /proc/sys/vm/dirty_background_ratio 
1

It looks like dirty_writeback is getting set to 10 minutes and the journal commit rate is also set to 10 minutes. Should dirty_background_bytes and dirty_bytes be nonzero?

Here are some relevant lines from /etc/laptop-mode/laptop-mode.conf:

LM_BATT_MAX_LOST_WORK_SECONDS=600
CONTROL_READAHEAD=1
LM_READAHEAD=3072
CONTROL_NOATIME=0
USE_RELATIME=1
CONTROL_HD_IDLE_TIMEOUT=1
LM_BATT_HD_IDLE_TIMEOUT_SECONDS=10
BATT_HD_POWERMGMT=1
CONTROL_HD_WRITECACHE=1
                                                                                                                                                     
NOLM_AC_HD_WRITECACHE=1
NOLM_BATT_HD_WRITECACHE=0
LM_HD_WRITECACHE=0

Any ideas what I'm missing?
Thanks in advance for any suggestions!

Offline

#2 2013-09-07 18:57:48

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: disk still wakes up with laptop-mode-tools

Do you use a swap partition? If so, is swap space used when those wake ups occur?

Offline

#3 2013-09-07 19:35:19

LeftyAce
Member
Registered: 2012-08-18
Posts: 93

Re: disk still wakes up with laptop-mode-tools

Thanks for the reply, cookies. I have no swap partition. Arch seems to be perfectly happy with well under the 2 GB of ram I've got :-)

Offline

#4 2013-10-03 04:35:33

kaczoanoker
Member
From: Roanoke, VA
Registered: 2013-03-15
Posts: 1

Re: disk still wakes up with laptop-mode-tools

I noticed that vim and emacs wake up the HD in laptop mode, but something like "dd if=/dev/zero of=~/test bs=1M count=1" doesn't. Does it mean that editors typically force-flush the buffers, which defeats the point of laptop-mode?

Last edited by kaczoanoker (2013-10-03 04:36:08)

Offline

#5 2013-10-08 13:48:31

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: disk still wakes up with laptop-mode-tools

kaczoanoker wrote:

I noticed that vim and emacs wake up the HD in laptop mode, but something like "dd if=/dev/zero of=~/test bs=1M count=1" doesn't.

Did ~/test already exist before you wrote a bunch of zeros to it? I'm asking because I know that vim creates a temporary file to work with (.$FILENAME.swp). So, the creation of this new file might force the wake up.

Offline

#6 2013-10-08 17:39:34

dfe
Member
Registered: 2013-10-08
Posts: 2

Re: disk still wakes up with laptop-mode-tools

kaczoanoker wrote:

I noticed that vim and emacs wake up the HD in laptop mode, but something like "dd if=/dev/zero of=~/test bs=1M count=1" doesn't. Does it mean that editors typically force-flush the buffers, which defeats the point of laptop-mode?

Vim calls fsync(2) when writing files and swap files per default. One can control this behavior with the fsync and swapsync options.
I don't know if Emacs has similar options.

Offline

Board footer

Powered by FluxBB