Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: John Moser <john.r.moser <at> gmail.com>
Subject: [RFC] zswap for Precise, with script
Newsgroups: gmane.linux.ubuntu.devel.discuss
Date: Thursday 17th May 2012 13:55:52 UTC (over 5 years ago)
Any thoughts on this?  I wrote it on a whim after installing an SSD and 
completely disabling all swap.  Haven't checked to see if Ubuntu 
supports hibernate to file yet (creating a hibernation file on demand 
would be optimal for me...)

This works with kernel 3.2.0 ... 3.0 used num_devices as the parameter 
for zram, while 2.6.32 used num (I think).  They keep changing the 
parameter name!

This init script (sorry, I have no clue how to write an upstart job) 
will load zram, set one of its devices to a given size, create swap on 
it, and turn that swap on.  It'll also deactivate the swap and free the 
associated RAM.

Accepted sizes are "half" and "quarter" of installed RAM as gotten by 
MemTotal in /proc/meminfo; any size in bytes; or suffixed K, M, G sizes.


/etc/default/zswap can contain the following variables:

# Set to 1 to disable
ZSWAP_DISABLED=0

# Number of /dev/zramX devices
ZRAM_NUM_DEVICES=4

# Swap device is /dev/$ZSWAP_DEVICE
ZSWAP_DEVICE="zram0"

# Size
ZSWAP_SIZE="quarter"
 
CD: 3ms