The ramzswap kernel module creates multiple ramzswap devices, equal to NUM_DEVICES parameter. With rzscontrol, you can control each of these devices.
This is how you use a ramzswap device (/dev/ramzswapX):
- Set parameters for [backing swap, memory limit] or [disk size] (see OPTIONS and EXAMPLES).
- Issue init once these parameters are set: rzscontrol /dev/ramzswapX --init.
- swapon /dev/ramzswapX (where X is ramzswap device id: 0, 1, 2... NUM_DEVICES-1).
- When you are done with this swap: swapoff /dev/ramzswapX. NOTE: swapoff will not free any compressed pages.
- After swapoff, issue reset: rzscontrol /dev/ramzswapX --reset. This will free all metadata and compressed pages.
OPTIONS
-b, --backing_swap
-
Specify backing swap device. This can either be a swap block device or a swap file. Writes are forwarded to this device when memory limit is reached or when a page is incompressible. You must swapoff backing swap device before init is issued, otherwise init will fail with -EBUSY error. Also, backing swap must be a valid swap device, otherwise 'swapon /dev/ramzswapX' will fail as if swapon was issued directly on the backing swap device.
-m, --memlimit_kb
-
Specify memory limit (in KB). This is the limit on amount of memory allocated for compressed pages. When this memory limit is reached, all further writes are forwarded to backing swap device. This option is valid only if backing swap is specified. This must be smaller than or equal to backing swap size. Default: 15% of RAM or backing swap size, whichever is smaller.
-d, --disksize_kb
-
Specify ramzswap disk size (in KB). This is the limit on number of (uncompressed) pages that can be stored in this device. This parameter is valid only when backing swap is not present since in that case, it is implicitly equal to size of the backing swap device. Default: 25% of RAM
-i, --init
-
Initialize given ramzswap device. It causes allocation of metadata for given ramzswap device and makes it ready to receive swap requests. Use
swapon(8)
to start using this device as swap.
-r, --reset
-
Resets given ramzswap device. It causes deallocation of metadata and any compressed pages for given ramzswap device. If the device is currently active, use
swapoff(8)
before issuing reset (otherwise -EBUSY error is returned).
-s, --stats
-
Show stats for given ramzswap device. If the ramzswap kernel module was compiled without STATS support, then most of the stats will be shown as 0.
-v, --verbose
-
Show verbose output from rzscontrol.
-h, --help
-
Shows usage information and some examples.
EXAMPLES
Following shows a typical sequence of steps for using ramzswap. Initialization can be done with many variations of configuration parameters as shown below.
Load Module:
-
insmod ramzswap.ko NUM_DEVICES=4 # creates 4 uninitialized devices: /dev/ramzswap{0,1,2,3}
Initialize:
-
rzscontrol /dev/ramzswap0 --init # uses default value of disksize_kb
rzscontrol /dev/ramzswap0 --disksize_kb=10240 --init
rzscontrol /dev/ramzswap1 --backing_swap=/dev/sda2 --init # uses default value of memlimit_kb
rzscontrol /dev/ramzswap1 --backing_swap=/dev/sda2 --memlimit_kb=10240 --init
rzscontrol /dev/ramzswap2 --backing_swap=/path/to/swap.file --memlimit_kb=10240 --init
Activate:
-
swapon /dev/ramzswap2 # or any other initialized ramzswap device
Stats:
-
rzscontrol /dev/ramzswap2 --stats
Deactivate:
-
swapoff /dev/ramzswap2
Reset:
-
rzscontrol /dev/ramzswap2 --reset
Unload Module:
-
rmmod ramzswap.ko
NOTE: ramzswap parameters cannot be changed once the device is initialized. It has to be reset before new parameters can be used.
SEE ALSO
mkswap(8),
swapon(8),
swapoff(8)
AUTHOR
Nitin Gupta <ngupta@vflare.org>
-
Developer
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- OPTIONS
-
- EXAMPLES
-
- SEE ALSO
-
- AUTHOR
-
This document was created by
man2html,
using the manual pages.
Time: 04:50:42 GMT, July 19, 2009