2004-03-29 15:42:58

by Bart Samwel

[permalink] [raw]
Subject: [PATCH] laptop-mode for 2.6, version 6

Hi guys,

Here's an updated version of the laptop-mode patch. The previous version
had some corner cases that it didn't handle gracefully; this version
should fix that. Also, thanks to Kiko Piris, the control script has been
much improved, now featuring linux 2.4 backward compatibility and
automatic remounts of filesystems. If you have any problems (or no
problems) with it, please let me know.

-- Bart

List of changes:

* Control script moved into a section of Documentation/laptop-mode.txt.

* Format string problem fixed.

* Control script is now able to remount all ext3/reiserfs filesystems
with commit=$MAX_AGE. It also removes the commit option when laptop mode
is stopped. If you don't want this, change DO_REMOUNTS to 0.

* Control script now works for Linux 2.4 as well, to facilitate
dual-booting.

* Reinstated the timer that I removed in the previous version. In
version 5, frequent reads could postpone writeback indefinitely, because
the kupdate writeback timer was updated to jiffies+5*HZ every time a
read was performed. Now the only thing that is postponed is laptop
mode's scheduling of writeback, and the normal writeback timer is not
touched.

* A situation that could arise in version 5 was that a process would
reach dirty_ratio dirty pages, and that it would stay at that level,
postponing writeback of all data every time balance_dirty_pages was run
(by resetting the timer to jiffies+5*HZ). In the attached patch,
previously scheduled writebacks are not postponed anymore.

* balance_dirty_pages doesn't trigger background writebacks anymore when
laptop mode is active. Version 5 disabled writebacks by setting
dirty_background_ratio to the same value as dirty_ratio, but as it turns
out this doesn't work: the kernel checks if dirty_background_ratio >=
dirty_ratio and if so, sets dirty_background_ratio = dirty_ratio/2.


Attachments:
laptop-mode-2.6.0-6.patch (19.51 kB)