LaptopMode

Richard Hughes hughsient at gmail.com
Thu Sep 15 08:59:27 PDT 2005


On Wed, 2005-09-14 at 18:05 +0200, Danny Kukawka wrote:
> On Wednesday 14 September 2005 17:05, Richard Hughes wrote:
> > Should we be doing:
> >
> > echo 1 > /proc/sys/vm/laptop_mode
> >
> > For SystemPowerManagement.SetPowerSave if
> >
> > smbios.chassis.type == Notebook
> >
> > Do you want a patch?
> 
> Not sure if this is a good idea in conjunction with smbios.chassis.type 
> because this key is not a really reliable information about the system type.

What about checking for battery.type == primary? That's only laptops I
guess - or not checking at all, and let the program (i.e. g-p-m) do the
filtering.

> Laptop mode on its own is not very usefull. You have to adjust the rest of 
> your system, too (e.g. by using the laptop-mode script).

Yes, but there is *lots* of extra stuff in the laptop-mode script.
re-mounting disks, setting hdd spindowns, and lots of kernel foo.

Spindowns have already been discussed, and remounting disks seems a bit
drastic.

I wanted to concentrate on the kernel-foo.

>From the laptop-mode scripts I can see that the main kernel "meaty bits"
are:
--------------------------------------------------

# Seconds laptop mode has to to wait after the disk goes idle before
doing a sync.
echo "x" > /proc/sys/vm/laptop_mode
default: 0
laptop-mode: 2

echo "x"> /proc/sys/vm/dirty_writeback_centisecs
default: 500
laptop-mode: 30

echo "x"> /proc/sys/vm/dirty_expire_centisecs
default: 3000
laptop-mode: 30

# Dirty synchronous ratio.  At this percentage of dirty pages the
process which calls write() does its own writeback.
echo "x"  > /proc/sys/vm/dirty_ratio
default: 40
laptop-mode: 60

# Allowed dirty background ratio, in percent.  Once DIRTY_RATIO has been
exceeded, the kernel will wake pdflush which will then reduce the amount
of dirty memory to dirty_background_ratio.  Set this nice and low, so
once some writeout has commenced, we do a lot of it.
echo "x" > /proc/sys/vm/dirty_background_ratio
default: 10
laptop-mode: 1

--------------------------------------------------

Shouldn't we just get some sane default values for these sorted out (the
ones laptop-mode seem sane), and then let all this be transparent to the
user?

Adding this little bit of code lets us to do the kernel cleverness,
without packaging the laptop-mode scripts, and having hal depend on
them.

What do you think?

Richard.




More information about the hal mailing list