Package: pm-utils Version: 1.4.1-15 Severity: important Tags: patch The laptop-mode hook tries to save the dirty_ratio and dirty_background_ratio values before it modifies them. This breaks, if the user set dirty_bytes or dirty_background_bytes before. In that case the _ratio files will read as "0". That in turn means that on "restore" of the "0" values to the _ratio files, which happens on laptop-mode switch off, dirty memory ratio will be set to zero. This heavily breaks disk write performance and renders the system mostly unusable.
The proposed patch tries to fix this by aborting the hook, if any ratio field is zero. -- System Information: Debian Release: 8.0 APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages pm-utils depends on: ii powermgmt-base 1.31+nmu1 Versions of packages pm-utils recommends: ii ethtool 1:3.16-1 ii hdparm 9.43-1.1 ii kbd 1.15.5-2 ii procps 2:3.3.9-8 ii vbetool 1.1-3 Versions of packages pm-utils suggests: ii cpufrequtils 008-1 pn radeontool <none> ii wireless-tools 30~pre9-8 -- no debconf information
--- laptop-mode.orig 2014-12-13 11:55:35.527031386 +0100 +++ laptop-mode 2014-12-13 12:01:44.430429767 +0100 @@ -48,6 +48,13 @@ [ -w $VM/laptop_mode -a -w $VM/dirty_ratio ] || exit $NA +# If the user set any of dirty_bytes or dirty_background_bytes +# the corresponding _ratio field will appear as 0. +# Abort in that case, because restoring 0 to any _ratio field will +# result in disabled dirty memory and thus heavy breakage. +[ "x0" = "x$(cat "$VM/dirty_ratio")" ] && exit $NA +[ "x0" = "x$(cat "$VM/dirty_background_ratio")" ] && exit $NA + read_values() { for f in $vmfiles; do [ -r "$VM/$f" ] && cat "$VM/$f" || echo 0