linux/drivers
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
..
accessibility
acpi Merge branch 'acpi-idle' into release 2010-06-04 15:23:02 -04:00
amba
ata sata_sil24: Use memory barriers before issuing commands 2010-06-10 16:06:48 -04:00
atm Merge remote branch 'origin' into secretlab/next-devicetree 2010-05-22 00:36:56 -06:00
auxdisplay auxdisplay: section cleanup in cfag12864bfb driver 2010-05-25 08:07:09 -07:00
base topology: convert cpu notifier to return encapsulate errno value 2010-05-27 09:12:48 -07:00
block spectra: Move to drivers/staging 2010-06-08 18:08:32 +01:00
bluetooth Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2010-05-20 21:04:44 -07:00
cdrom of: Always use 'struct device.of_node' to get device node pointer. 2010-05-18 16:10:44 -06:00
char Revert "tty: fix a little bug in scrup, vt.c" 2010-06-06 20:44:04 -07:00
clocksource clocksource: sh_cmt: compute mult and shift before registration 2010-06-02 17:10:44 +09:00
connector
cpufreq Merge branch 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-05-18 08:49:13 -07:00
cpuidle Merge branch 'idle-release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-idle-2.6 2010-05-28 16:14:17 -07:00
crypto crypto: crypto4xx - Fix build breakage 2010-06-03 16:57:24 +10:00
dca
dio
dma of/dma: fix build breakage in ppc4xx adma driver 2010-06-02 21:02:39 -06:00
edac Merge branch 'linux_next' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/i7core 2010-06-04 15:39:54 -07:00
eisa
firewire firewire: core: check for 1394a compliant IRM, fix inaccessibility of Sony camcorder 2010-06-02 19:48:13 +02:00
firmware sysfs: add struct file* to bin_attr callbacks 2010-05-21 09:37:31 -07:00
gpio gpio: Fix inverted rdc321x gpio data out registers 2010-05-28 01:37:59 +02:00
gpu Revert "drm/i915: Don't enable pipe/plane/VCO early (wait for DPMS on)." 2010-06-08 20:16:28 -07:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2010-05-27 09:19:55 -07:00
hwmon i2c: Remove all i2c_set_clientdata(client, NULL) in drivers 2010-06-03 11:33:58 +02:00
i2c i2c: Remove all i2c_set_clientdata(client, NULL) in drivers 2010-06-03 11:33:58 +02:00
ide powerpc/macio: Fix probing of macio devices by using the right of match table 2010-06-02 17:50:38 +10:00
idle intel_idle: native hardware cpuidle driver for latest Intel processors 2010-05-28 14:26:20 -04:00
ieee1394 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6 2010-05-27 10:22:06 -07:00
ieee802154
infiniband fix the deadlock in qib_fs 2010-06-04 17:16:27 -04:00
input hp_sdc_rtc: fix broken ioctl conversion 2010-06-08 22:23:21 +02:00
isdn isdn/kcapi: return -EFAULT on copy_from_user errors 2010-06-03 03:28:22 -07:00
leds i2c: Remove all i2c_set_clientdata(client, NULL) in drivers 2010-06-03 11:33:58 +02:00
lguest
macintosh Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2010-06-03 15:46:37 -07:00
mca
md md: convert cpu notifier to return encapsulate errno value 2010-05-27 09:12:48 -07:00
media Merge branch 'v4l_for_2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6 2010-06-04 15:38:12 -07:00
memstick
message drivers/message/i2o/i2o_config.c: use memdup_user 2010-05-27 09:12:41 -07:00
mfd i2c: Remove all i2c_set_clientdata(client, NULL) in drivers 2010-06-03 11:33:58 +02:00
misc vmware balloon: clamp number of collected non-balloonable pages 2010-06-04 15:21:44 -07:00
mmc mmc: msm: fix compile error on MSM7x30 2010-06-09 08:51:31 -07:00
mtd Merge git://git.infradead.org/~dwmw2/mtd-2.6.35 2010-06-07 17:10:06 -07:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2010-06-11 14:20:03 -07:00
nubus
of Merge remote branch 'origin' into secretlab/next-devicetree 2010-05-22 00:36:56 -06:00
oprofile
parisc
parport m68k: amiga - Parallel port platform device conversion 2010-05-26 19:51:09 +02:00
pci Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2010-06-11 14:15:44 -07:00
pcmcia pcmcia: avoid validate_cis failure on CIS override 2010-06-07 18:34:16 +02:00
platform intel_scu_ipc: Length fix 2010-06-01 08:40:47 -07:00
pnp
power i2c: Remove all i2c_set_clientdata(client, NULL) in drivers 2010-06-03 11:33:58 +02:00
pps
ps3
rapidio rapidio: fix new kernel-doc warnings 2010-05-30 09:02:47 -07:00
regulator i2c: Remove all i2c_set_clientdata(client, NULL) in drivers 2010-06-03 11:33:58 +02:00
rtc rtc: s3c: initialize s3c_rtc_cpu_type before using it 2010-06-04 15:21:44 -07:00
s390 [S390] appldata/extmem/kvm: add missing GFP_KERNEL flag 2010-06-08 18:58:23 +02:00
sbus Merge branch 'bkl/ioctl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing 2010-05-24 08:01:10 -07:00
scsi Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev 2010-06-03 15:48:15 -07:00
serial serial: add support for various Titan PCI cards 2010-06-04 13:37:18 -07:00
sfi SFI: do not return freed pointer 2010-06-01 12:04:35 -04:00
sh sh: Make intc messages consistent via pr_fmt. 2010-06-02 18:10:00 +09:00
sn
spi of/spi: mpc512x_psc_spi.c: Fix build failures 2010-06-02 13:45:06 -06:00
ssb ssb: fix NULL ptr deref when pcihost_wrapper is used 2010-05-28 13:57:01 -04:00
staging Staging: ramzswap: Support generic I/O requests 2010-06-18 12:45:40 -07:00
tc
telephony drivers/telephony/ixj.c: use memdup_user 2010-05-27 09:12:42 -07:00
thermal
uio
usb Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6 2010-06-04 15:42:09 -07:00
uwb
vhost misc: Fix allocation 'borrowed' by vhost_net 2010-06-09 08:50:31 -07:00
video Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6 2010-06-04 15:42:09 -07:00
virtio Merge branch 'virtio' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus 2010-05-21 17:22:52 -07:00
vlynq
w1 sysfs: add struct file* to bin_attr callbacks 2010-05-21 09:37:31 -07:00
watchdog [PATCH 2/11] drivers/watchdog: Eliminate a NULL pointer dereference 2010-06-07 15:55:03 +00:00
xen xen: avoid allocation causing potential swap activity on the resume path 2010-06-03 09:34:45 +01:00
zorro sysfs: add struct file* to bin_attr callbacks 2010-05-21 09:37:31 -07:00
Kconfig
Makefile intel_idle: native hardware cpuidle driver for latest Intel processors 2010-05-28 14:26:20 -04:00