linux/drivers/staging
Nitin Gupta a1dd52afa9 Staging: ramzswap: Support generic I/O requests
Currently, ramzwap devices (/dev/ramzswapX) can only
be used as swap disks since it was hard-coded to consider
only the first request in bio vector.

Now, we iterate over all the segments in an incoming
bio which allows us to handle all kinds of I/O requests.

ramzswap devices can still handle PAGE_SIZE aligned and
multiple of PAGE_SIZE sized I/O requests only. To ensure
that we get always get such requests only, we set following
request_queue attributes to PAGE_SIZE:
 - physical_block_size
 - logical_block_size
 - io_min
 - io_opt

Note: physical and logical block sizes were already set
equal to PAGE_SIZE and that seems to be sufficient to get
PAGE_SIZE aligned I/O.

Since we are no longer limited to handling swap requests
only, the next few patches rename ramzswap to zram. So,
the devices will then be called /dev/zram{0, 1, 2, ...}

Usage/Examples:
 1) Use as /tmp storage
 - mkfs.ext4 /dev/zram0
 - mount /dev/zram0 /tmp

 2) Use as swap:
 - mkswap /dev/zram0
 - swapon /dev/zram0 -p 10 # give highest priority to zram0

Performance:

 - I/O benchamark done with 'dd' command. Details can be
found here:
http://code.google.com/p/compcache/wiki/zramperf
Summary:
 - Maximum read speed (approx):
   - ram disk: 1200 MB/sec
   - zram disk: 600 MB/sec
 - Maximum write speed (approx):
   - ram disk: 500 MB/sec
   - zram disk: 160 MB/sec

Issues:

 - Double caching: We can potentially waste memory by having
two copies of a page -- one in page cache (uncompress) and
second in the device memory (compressed). However, during
reclaim, clean page cache pages are quickly freed, so this
does not seem to be a big problem.

 - Stale data: Not all filesystems support issuing 'discard'
requests to underlying block devices. So, if such filesystems
are used over zram devices, we can accumulate lot of stale
data in memory. Even for filesystems to do support discard
(example, ext4), we need to see how effective it is.

 - Scalability: There is only one (per-device) de/compression
buffer stats. This can lead to significant contention, especially
when used for generic (non-swap) purposes.

Signed-off-by: Nitin Gupta <ngupta@vflare.org>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-06-18 12:45:40 -07:00
..
adis16255 Staging: adis16255: add proper section markings to hotplug funcs 2010-06-04 13:38:57 -07:00
asus_oled Staging: asus_oled: asus_oled.c: Checkpatch cleanup 2010-05-11 11:35:30 -07:00
batman-adv Staging: batman-adv: Don't allocate icmp packet with GFP_KERNEL 2010-06-04 13:38:56 -07:00
comedi Staging: comedi: drivers: fix coding style issues in pcl812.c 2010-06-18 09:16:44 -07:00
crystalhd Staging: crystalhd: Remove typedefs from driver 2010-05-18 14:53:17 -07:00
cx25821 Merge staging-next tree into Linus's latest version 2010-05-21 12:48:55 -07:00
cxt1e1 staging: cxt1e1: fix semaphore build breakage 2010-05-11 14:15:34 -07:00
dream i2c: Remove all i2c_set_clientdata(client, NULL) in drivers 2010-06-03 11:33:58 +02:00
dt3155 Staging: Eliminate a NULL pointer dereference 2010-06-04 13:38:57 -07:00
dt3155v4l Staging: dt3155v4l: remove private memory allocator 2010-05-18 14:53:17 -07:00
easycap Staging: easycap: add easycap driver 2010-06-18 12:34:42 -07:00
echo staging: trivial: fix typo "seperate" 2010-05-14 13:16:10 -07:00
et131x Staging: et131x: Small format/style tidyups 2010-06-17 16:08:45 -07:00
frontier staging: frontier: switch semaphores to mutexes 2010-05-11 11:35:33 -07:00
go7007 i2c: Remove all i2c_set_clientdata(client, NULL) in drivers 2010-06-03 11:33:58 +02:00
hv Staging: hv: Storage class should be before const qualifier 2010-06-18 09:22:28 -07:00
iio staging: Use GFP_ATOMIC when a lock is held 2010-06-04 13:38:57 -07:00
line6 Staging: Use kmemdup 2010-05-17 16:31:15 -07:00
memrar staging: memrar depends on RAR_REGISTER 2010-05-11 15:56:19 -07:00
mrst-touchscreen Staging: mid: Intel MID touch screen driver 2010-06-04 13:38:51 -07:00
msm Staging: add MSM framebuffer driver 2010-06-04 13:38:54 -07:00
octeon STAGING: octeon-ethernet: Use proper phy addresses for Movidis hardware. 2010-04-30 20:52:53 +01:00
otus Staging: Use kcalloc or kzalloc 2010-05-14 14:02:56 -07:00
panel Staging: Use kcalloc or kzalloc 2010-05-14 14:02:56 -07:00
phison Staging: phison: depends on ATA_BMDMA 2010-06-04 13:38:57 -07:00
pohmelfs Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6 2010-05-30 09:11:11 -07:00
quatech_usb2 Staging: quatech_usb2: fix coding style issues 2010-05-11 11:35:54 -07:00
ramzswap Staging: ramzswap: Support generic I/O requests 2010-06-18 12:45:40 -07:00
rar_register Staging: rar_register: depends on PCI 2010-05-11 11:36:19 -07:00
rt2860 Staging: rc2860: return -EFAULT on copy_to_user errors 2010-06-04 13:38:58 -07:00
rt2870 Staging: rt2870: Allow building on ARM 2010-05-11 11:35:55 -07:00
rt3070 Staging: rt3070: md4.h: Checkpatch cleanup 2010-03-03 16:43:07 -08:00
rtl8187se Staging: Use kmemdup 2010-05-17 16:31:15 -07:00
rtl8192e Staging: Use kmemdup 2010-05-17 16:31:15 -07:00
rtl8192su Merge staging-next tree into Linus's latest version 2010-05-21 12:48:55 -07:00
rtl8192u Staging: Use kmemdup 2010-05-17 16:31:15 -07:00
samsung-laptop backlight: Allow properties to be passed at registration 2010-03-16 19:47:54 +00:00
sep Staging: sep: return -EFAULT on copy_to_user errors 2010-06-04 13:38:58 -07:00
serqt_usb2 Staging: serqt_usb2: fix space coding style issue in serqt_usb2.c 2010-05-11 11:35:54 -07:00
slicoss net: convert multicast list to list_head 2010-04-03 14:22:15 -07:00
sm7xx Staging: Use kcalloc or kzalloc 2010-05-14 14:02:56 -07:00
spectra spectra: Rename config options 2010-06-08 18:28:24 +01:00
ti-st Staging: ti-st: fix protocol counting 2010-06-18 12:40:29 -07:00
tm6000 V4L/DVB: tm6000: add DVB support for tuner xc5000 2010-06-01 01:22:07 -03:00
udlfb Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6 2010-05-21 15:26:46 -07:00
usbip Merge staging-next tree into Linus's latest version 2010-05-21 12:48:55 -07:00
vme staging: Use GFP_ATOMIC when a lock is held 2010-06-04 13:38:57 -07:00
vt6655 Staging: vt6655: struct pci_driver cleanup 2010-06-18 10:42:07 -07:00
vt6656 Staging: vt665*: fix typos concerning "management" 2010-06-18 10:42:07 -07:00
winbond Staging: winbond: fix some checkpatch.pl issues in phy_calibration.c 2010-06-18 10:01:31 -07:00
wlags49_h2 Staging: wlags49_h2, wlags49_h25: fixed Kconfig dependencies 2010-06-04 13:38:57 -07:00
wlags49_h25 Staging: wlags49_h2, wlags49_h25: fixed Kconfig dependencies 2010-06-04 13:38:57 -07:00
wlan-ng Staging: wlan-ng prism2usb: add suspend/resume 2010-05-17 16:33:28 -07:00
xgifb staging: Add framebuffer driver for XGI chipsets 2010-06-04 13:38:51 -07:00
Kconfig Staging: easycap: add easycap driver 2010-06-18 12:34:42 -07:00
Makefile Staging: easycap: add easycap driver 2010-06-18 12:34:42 -07:00
staging.c Staging: workaround build system bug 2008-10-13 14:32:52 -07:00