Package: pm-utils
Version: 1.4.1-9
Severity: normal
Tags: patch

=== Problem and consideration ===

I was trying to set slow updates for my SSD on my laptop even under AC
power
====
# ssd_ac_mode default (for testing)
vm.laptop_mode      = 5
vm.dirty_ratio      = 60
vm.background_ratio = 40
vm.dirty_writeback_centisecs = 60000
====
It did not work.

Reading manpage  of pm-powersave did not give me any hints.

Reading pm-utils source and few experiments lead me to realize that the
hard-coded numbers embedded in the laptop_mode as "write_values 0 10 5
500" was the place to edit such configuration.  This is absurd.

This may be somewhat of regression of parallel init script.  This script
was executed after /etc/syscyrl.conf now and since there were no state
file this hard-coded value was used when booted under AC.
/etc/syscyrl.conf was used for AC when booted under battery and plugged.

=== Solution 1: simple fix ===

In laptop_mode, change laptop_mode_ac() function as follows.

===
laptop_mode_ac() {
    # disable laptop mode, set vm parameters back to sane defaults
    if state_exists laptop_mode_default; then
        write_values $(restorestate laptop_mode_default)
    fi
    echo "Laptop mode disabled."
}
===
If you wish to change via /etc/syscyrl.conf for AC setting, it works.

=== Solution 2: robust fix with added feature ===

Since above hard-coded segment may have been introduced for some other
interference, I think simple solution of providing legible and fixed
code setting both AC and battery mode should be safer and more stable
for /usr/lib/pm-utils/power.d/laptop-mode.

This code has additional benefit of using slow battery mode for SSD on
laptop as default.

If you think this is too much for default configuration, please consider
to add this to /usr/share/pm-utils/examples/laptop_mode

====== EXPERIMENTAL RESULT =====
= Normal system =

== Normal - start on AC ==

• boot on AC
• hard-coded AC setting in laptop_mode of pm-utils (no state file)
• unplug
• hard-coded BATT setting in laptop_mode of pm-utils (state file with 
hard-coded AC setting in laptop_mode of pm-utils) 
• plug
• hard-coded AC setting in laptop_mode of pm-utils

== Normal - start on BATT ==

• boot on BATT
• hard-coded BATT setting in laptop_mode of pm-utils (state file with 
sysctrl.conf)
• plug
• setting in /etc/sysctrl.conf content (state file with sysctrl.conf)
• unplug
• hard-coded BATT setting in laptop_mode of pm-utils (state file with 
sysctrl.conf)

= Disable hard-coded AC - solution 1 applied =

= Disable hard-coded AC - start on AC =

• boot on AC
• setting in /etc/sysctrl.conf content (no state file)
• unplug
• hard-coded BATT setting in laptop_mode of pm-utils (state file with 
sysctrl.conf)
• plug
• setting in /etc/sysctrl.conf content (state file with sysctrl.conf)

= Disable hard-coded AC - start on BATT =

• boot on BATT
• hard-coded BATT setting in laptop_mode of pm-utils (state file with 
sysctrl.conf)
• plug
• setting in /etc/sysctrl.conf content (state file with sysctrl.conf)
• unplug


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages pm-utils depends on:
ii  powermgmt-base  1.31

Versions of packages pm-utils recommends:
ii  hdparm   9.32-1
ii  kbd      1.15.3-7
ii  procps   1:3.3.2-3
ii  vbetool  1.1-2

Versions of packages pm-utils suggests:
ii  cpufrequtils    007-2
ii  ethtool         1:3.1-1
ii  radeontool      1.6.2-1.1
ii  wireless-tools  30~pre9-8

-- no debconf information



--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to