Swappolube

(tcp_timestamps)
m (Reverted edits by 62.152.39.215 (Talk) to last revision by 85.23.163.231)
 
(2 intermediate revisions not shown)
Line 127: Line 127:
===Laptop Mode===
===Laptop Mode===
-
* Description: laptop_mode is a knob that controls "laptop mode". When the knob is set, any physical disk I/O (that might have caused the hard disk to spin up, see <code>/proc/sys/vm/block_dump</code>) causes Linux to flush all dirty blocks. The result of this is that after a disk has spun down, it will not be spun up anymore to write dirty blocks, because those blocks had already been written immediately after the most recent read operation. The value of the laptop_mode knob determines the time between the occurrence of disk I/O and when the flush is triggered. A sensible value for the knob is 5 seconds. Setting the knob to 0 disables laptop mode. Since this mode has been designed with mechanical hard drives in mind to maximize the time between spin-ups that the flash memory in a cellphone does not need to worry itself with, it might actually be better to set this to zero.
+
* Description: When the value for laptop_mode is set to be something other than zero, any physical disk I/O (that might have caused the hard disk to spin up, see <code>/proc/sys/vm/block_dump</code>) causes Linux to flush all dirty blocks after the value in seconds. The result of this is that after a disk has spun down, it will not be spun up anymore to write dirty blocks, because those blocks had already been written immediately after the most recent read operation. The value of the laptop_mode knob determines the time between the occurrence of disk I/O and when the flush is triggered. A sensible value for the knob is 5 seconds. Setting the knob to 0 disables laptop mode. Since this mode has been designed with mechanical hard drives in mind to maximize the time between spin-ups that the flash memory in a cellphone does not need to worry itself with, it might actually be better to set this to zero.
* Default: "0"
* Default: "0"
* Suggested: "1"
* Suggested: "1"

Latest revision as of 16:31, 14 August 2013

The SWAPPOLUBE is a user interface to the configuration of several parameters of the N900 kernel with the aim to make it faster.

It provides the ability to change a number of parameters while in operation and if chosen will make them persistent by adding a script to event.d to set them after each boot.

It has been created with PyQT (PyQt v4.7.5 for Python v2.6) and the functionality is provided by Python.

The configuration options have been discussed in (at least) two talk.maemo.org threads: "How to set swappiness" and "Swappolube to lubricate your gui".

Contents

[edit] Installation

The application can be installed directly by the Application Manager (HAM) from the Extras repositories (check here for its status).

You can also find the latest version in the garage project page.

[edit] Dependencies

The editor depends on:

  • python2.5
  • python2.5-qt4-gui
  • python2.5-qt4-core
  • python2.5-qt4-maemo5

[edit] Usage

When the application loads it reads and displays the current configuration and the options already used by the system and displays them in the appropriate sections of the GUI.

[edit] Main configuration

  • The first row of checkboxes is to enable the setting.
    • If unchecked it will not write anything for that option.
  • The second row can offer either string entry or a checkbox.
    • String: is an integer value up to 4 digits.
    • Checkbox: if checked will propagate a "1", if not checked it will be a "0" , i.e. set True or False for this option.

Main View

The centre part of the UI is a scrollable list. Scrolling to the bottom will show all available options as well as the button to store a custom version of the settings.

note: since version 1.4 the application supports rotation depending the orientation of the device.

Main View - rotated

[edit] Current Button

Pressing the "Current" button will read and display the current configuration the system uses.

[edit] Proposed Button

[edit] Custom Button

[edit] Drop down menu

The drop down menu, aka Menubar, will offer the following options:

  • Button: Delete Tuning File (will appear only if a tuning file exists)
  • Button: Restore Default Values
  • Button: Add PowerKey entry or Remove PowerKey entry
  • Button: About
  • Button: Quit

If a tuning file exists, the option to delete it will appear:

Adding a application start button in the Power key menu entry:

[edit] Popup Menu

Several popups inform the user on the action taken.

[edit] New Config Applied

[edit] New Config Created

[edit] Delete Tuning File

[edit] About

In the about window one can find the version of the application running as well as buttons to connect to additional documentation (like all the rest of the windows it supports rotation).

[edit] Explanation of options

Here is a short description of settings and the actual commands that will be used to set them. A further reading is suggested to understand better the implications involved and finding the appropriate values for your type of use of the device.

[edit] Swappiness

  • Description: The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. Because disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory. [1]
  • Default: "100"
  • Suggested: "30"
  • Code:
    echo "30" > /proc/sys/vm/swappiness

[edit] Page Cluster

  • Description: page-cluster controls the number of pages which are written to swap in a single attempt. The swap I/O size.It is a logarithmic value - setting it to zero means "1 page", setting it to 1 means "2 pages", setting it to 2 means "4 pages", etc. The default value is three (eight pages at a time). There may be some small benefits in tuning this to a different value if your workload is swap-intensive. [2]
  • Default: "5"
  • Suggested: "0"
  • Code:
    echo "0" > /proc/sys/vm/page-cluster

[edit] Laptop Mode

  • Description: When the value for laptop_mode is set to be something other than zero, any physical disk I/O (that might have caused the hard disk to spin up, see /proc/sys/vm/block_dump) causes Linux to flush all dirty blocks after the value in seconds. The result of this is that after a disk has spun down, it will not be spun up anymore to write dirty blocks, because those blocks had already been written immediately after the most recent read operation. The value of the laptop_mode knob determines the time between the occurrence of disk I/O and when the flush is triggered. A sensible value for the knob is 5 seconds. Setting the knob to 0 disables laptop mode. Since this mode has been designed with mechanical hard drives in mind to maximize the time between spin-ups that the flash memory in a cellphone does not need to worry itself with, it might actually be better to set this to zero.
  • Default: "0"
  • Suggested: "1"
  • Code:
    echo "1" > /proc/sys/vm/laptop_mode

[edit] oom_kill_allocating_task

  • Description: This enables or disables killing the OOM-triggering task in out-of-memory situations. If this is set to zero, the OOM killer will scan through the entire tasklist and select a task based on heuristics to kill. This normally selects a rogue memory-hogging task that frees up a large amount of memory when killed. If this is set to non-zero, the OOM killer simply kills the task that triggered the out-of-memory condition. This avoids the expensive tasklist scan and the potential randomness of the task that the manager picked to kill. If panic_on_oom is selected, it takes precedence over whatever value is used in oom_kill_allocating_task. Taken from: [3]
  • Default: "0"
  • Suggested: "1"
  • Code:
    echo "1" > /proc/sys/vm/oom_kill_allocating_task

[edit] dirty_expire_centisecs

  • Description: This tunable is used to define when dirty data is old enough to be eligible for writeout by the pdflush daemons. It is expressed in 100'ths of a second. Data which has been dirty in memory for longer than this interval will be written out next time a pdflush daemon wakes up. [4]
  • Default: "500"
  • Suggested: "0"
  • Code:
    echo "0" > /proc/sys/vm/dirty_expire_centisecs

[edit] dirty_writeback_centisecs

  • Description: The pdflush writeback daemons will periodically wake up and write "old" data out to disk. This tunable expresses the interval between those wakeups, in 100'ths of a second. Setting this to zero disables periodic writeback altogether. [5]
  • Default: "500"
  • Suggested: "0"
  • Code:
    echo "0" > /proc/sys/vm/dirty_writeback_centisecs

[edit] dirty_background_ratio

  • Description: Contains, as a percentage of total system memory, the number of pages at which the pdflush background writeback daemon will start writing out dirty data. [6]
  • Default: "10"
  • Suggested: "60"
  • Code:
    echo "60" > /proc/sys/vm/dirty_background_ratio

[edit] dirty_ratio

  • Description: Contains, as a percentage of total system memory, the number of pages at which a process which is generating disk writes will itself start writing out dirty data. [7]
  • Default: "40"
  • Suggested: "95"
  • Code:
    echo "95" > /proc/sys/vm/dirty_ratio

[edit] tcp_timestamps

  • Description: Enable timestamps as defined in RFC1323. [8] Turning off TCP timestamps can be counterproductive, since timestamps are used to estimate data packet round-trip times and transmission timeouts. Disabling RFC1323 timestamps may then result in poor performance in conditions of frequent packet losses. The Swappolube suggested default is to turn them off, but it may not in fact be optimal.
  • Default: "1"
  • Suggested: "0"
  • Code:
    echo "0" > /proc/sys/net/ipv4/tcp_timestamps

[edit] tcp_no_metrics_save

  • Description: Normally, TCP will remember some characteristics about the last connection in the flow cache. If tcp_no_metrics_save is set, then it doesn't. Useful for benchmarks or other tests. [9]
  • Default: "0"
  • Suggested: "1"
  • Code:
    echo "1" > /proc/sys/net/ipv4/tcp_no_metrics_save

[edit] VFS Cache Pressure

  • Description: Controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects. At the default value of vfs_cache_pressure = 100 the kernel will attempt to reclaim dentries and inodes at a "fair" rate with respect to pagecache and swapcache reclaim. Decreasing vfs_cache_pressure causes the kernel to prefer to retain dentry and inode caches. Increasing vfs_cache_pressure beyond 100 causes the kernel to prefer to reclaim dentries and inodes.
  • Default: "100"
  • Suggested: "100" (in search)
  • Code:
    echo "100" > /proc/sys/vm/vfs_cache_pressure

[edit] Versions

[edit] 1.4-2 (stable version)

[edit] Changelog

  • Modification of the UI to expand on all the available screen estate.

[edit] Issues

  • none known/reported.

[edit] 1.4-1

[edit] Changelog

  • Modifications in the postrm and the postinstall script.
  • Installation triggers compilation of the code and removal of not needed files.
  • Added simple file to start the UI.
  • Modification of the UI to support rotation.

[edit] 1.1-6

[edit] Changelog

  • Added a dynamic button in the application menu to add/remove the entry in the Power Key menu.
  • Modified the application menu entry for deleting the tuning file to appear only when file exists.
  • Added a postrm script to remove settings made by the application when uninstalled.
  • Added new entries in the update script.
  • Renamed a few files and methods to have understandable descriptions.

[edit] 1.1-3

[edit] Changelog

  • Added new options to support modifications for interactivity improvement under high I/O load (as discussed in this maemo talk thread).
  • Changes in the postinstall script to compile the code.

[edit] 1.0-1

[edit] Changelog

  • Added new option to store and display a custom configuration.
  • Several GUI improvements (buttons moved to the left, description includes default values, ...).
  • Clean-up of code; better naming of variables.
  • Changes in the postinstall script to include the custom settings file.
  • Bump version number - the application is now feature complete.

[edit] 0.4-1

[edit] Changelog

  • Restructure of the GUI to have a scrollable list and the buttons on the right.
  • Added better information messages on several actions.

[edit] 0.3-4

[edit] Changelog

  • Added signals to show only the enabled options.
  • Added better information messages on several actions.
  • Added check if the Delete Tuning option really deleted the file.

[edit] 0.3-3

[edit] Changelog

  • Fix typo in the About window.

[edit] 0.3-2

[edit] Changelog

  • Added new menu button to restore default values.
  • Code cleanup and some better comments.
  • New About window with connection to the wiki page and rotation support.
  • Removed Credits window (it is included in the About).
  • Some small UI beatifications and better ordering of the entry fields.

[edit] 0.3-1

[edit] Changelog

  • Removed indirect dependency to the rootsh package (i.e. root command).
  • Update in sudoers.
  • Added new script to update, store and delete the configuration values.
  • Restricted privileges of companion files.

[edit] Issues

  • none known/reported.

[edit] 0.2.0-3

[edit] Changelog

  • Fix in the update of the VFSCachePressure value. Previous version did not store this correctly.
  • Fix in the reading of values from the system. A hiden linebreak (shown as space) was added in all values after hitting "Current" which blocked their later update.

[edit] Issues

  • depends indirectly on rootsh package.

[edit] 0.2.0-2

[edit] Changelog

  • Change of the Laptop Mode setting to string.
  • Updated description.
  • Some UI changes - beautifications.

[edit] 0.2.0-1

[edit] Changelog

  • Added two new buttons (current & proposed) to set the settings in the GUI.
  • Added icons for the application manager and the desktop.
  • Many code changes/splits in methods.
  • Added several protections when handling updates.
  • Fixed in GUI directional errors.
  • Constrained the entry values to 4 digits.

[edit] 0.1.0-8

[edit] Changelog

  • New button to update the settings.
  • Transformed several fields from boolean to strings.

NOTE: For older versions please see the changelogs in the project's garage page

[edit] Future Development

Note: Just add your thoughts (username)..

  • Read the current configuration stored in the tuning script and automatically display it.
  • Provide a button to show the default configuration.
  • Store/Read the configuration from a file (easy for sharing).

[edit] Swappolube-nogui

For those who don't want to tinker too much with kernel parameters, the package swappolube-nogui provides a fixed tuning profile "known to work". Kernel parameters are modified at installation time, and the modification persist at the next boots. Package removal reverts parameters to the default values. The swappolube-nogui package conflicts with the swappolube package because both use the same script /etc/event.d/tuning for persistence. The common application managers should prompt for removal of one when trying to install the other.

[edit] License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 only.

[edit] Disclaimer

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.