[laptop-mode] Enabling Laptop Mode Activate Pdflush Every 3-4 Seconds

Bart Samwel bart at samwel.tk
Fri May 29 09:43:15 CEST 2009


Hi Casey,

Casey McGinty wrote:
> On Wed, May 27, 2009 at 1:33 AM, Bart Samwel <bart at samwel.tk 
> <mailto:bart at samwel.tk>> wrote:
> 
> 
>     The thing is, laptop mode works as follows:
> 
>     - Detect disk activity -> activate!
>     - Wait until disk activity stops for 2 seconds
>     - Sync and deactivate!
> 
>     I'm getting the impression that this is caused by some kind of
>     after-the-sync-finishes disk activity by the md drivers. Because then it
>     works like this:
> 
>     - Detect disk activity -> activate!
>     - Wait until disk activity stops for 2 seconds
>     - Sync and deactivate
>     - ...something in md is still writing to disk after the sync has
>     returned
>     - Detect disk activity -> activate!
> 
>     However, this is hard to detect without logging of sync boundaries and
>     laptop mode activation / deactivation, and that's not in the kernel. :-/
>     Do you compile your own kernels or do you run a stock kernel?
> 
> 
> Thanks Bart,
> 
> The kernel is Stock from Ubuntu 9.04.

OK, I have that too, so I can try and debug with that.

> The interesting point is that there is zero disk activity when laptop 
> mode is *disable*. Even to the point that the RAID array will spindown 
> after 5 or 10 minutes. When laptop mode is enabled (and this is the only 
> change) the drive lights are constantly flashing every few seconds. I 
> have a separate indicator lights on the 4 drives in my RAID array, and 
> ALL the lights become active.
> 
> How do you explain this? Even if there is are 100's of processes writing 
> to my other volumes, the large RAID array is usually idle as they are 
> not part of the standard Linux FS path.

The thing is, laptop mode does a sync *across all file systems*. And 
that causes disk activity even on file systems that aren't being used 
much. Combine this with a laptop mode sync loop (as you are 
experiencing) and it becomes very annoying. :-/

> Can you recommend any more tests that might test out the scenario above. 
> For example, is there a way to change the 2 second delay, to something 
> longer? Has anyone else verified that laptop-mode works with the RAID 
> sub-system?

I personally haven't verified this, so I will have to go and build such 
a set-up myself to reproduce the problem. I strongly suspect that LVM 
writes data after the sync is complete, which causes laptop mode to 
trigger a re-sync after two seconds.

(BTW, increasing the sync timeout to something larger than 2 seconds 
completely defeats the purpose of laptop mode, so you *really* don't 
want that!)

Cheers,
Bart


More information about the laptop-mode mailing list