Skip to contentSkip to conversation

compcache: virtual block device driver (ramzswap)

PATCH In review Nitin Gupta 1 participant 1 message Aug 24, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/4 compcache: virtual block device driver (ramzswap)

Creates RAM based block devices (/dev/ramzswapX) which can be used (only) as swap disks. Pages swapped to these are compressed and stored in memory itself.

The module is called ramzswap.ko. It depends on:
- xvmalloc.ko: memory allocator
- lzo_compress.ko
- lzo_decompress.ko

See Documentation/blockdev/ramzswap.txt for usage details.

---
 drivers/block/Kconfig             |   22 +
 drivers/block/Makefile            |    1 +
 drivers/block/ramzswap/ramzswap.c | 1518 +++++++++++++++++++++++++++++++++++++
 drivers/block/ramzswap/ramzswap.h |  182 +++++
 include/linux/ramzswap_ioctl.h    |   51 ++
 5 files changed, 1774 insertions(+), 0 deletions(-)
drivers/block/Kconfig +22 -0
index 1d886e0..9c769e1 100644
@@ -371,6 +371,28 @@ config BLK_DEV_RAM_SIZE
 	  The default value is 4096 kilobytes. Only change this if you know
 	  what you are doing.
 
+config BLK_DEV_RAMZSWAP
+	tristate "Compressed in-memory swap device"
+	depends on SWAP
+	select LZO_COMPRESS
+	select LZO_DECOMPRESS
+	default m
+	help
+	  Creates virtual block device which can be used (only) as a swap
+	  device. Pages swapped to this device are compressed and stored in
+	  memory itself.
+
+	  See Documentation/blockdev/ramzswap.txt for more information.
+	  Project home: http://compcache.googlecode.com/
+
+config BLK_DEV_RAMZSWAP_STATS
+	bool "Enable ramzswap stats"
+	depends on BLK_DEV_RAMZSWAP
+	default y
+	help
+	  Enable statistics collection for ramzswap. This adds only a minimal
+	  overhead. In unsure, say Y.
+
 config BLK_DEV_XIP
 	bool "Support XIP filesystems on RAM block device"
 	depends on BLK_DEV_RAM
drivers/block/Makefile +1 -0
index cdaa3f8..174efcc 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_PS3_VRAM)		+= ps3vram.o
 obj-$(CONFIG_ATARI_FLOPPY)	+= ataflop.o
 obj-$(CONFIG_AMIGA_Z2RAM)	+= z2ram.o
 obj-$(CONFIG_BLK_DEV_RAM)	+= brd.o
+obj-$(CONFIG_BLK_DEV_RAMZSWAP)	+= ramzswap/
 obj-$(CONFIG_BLK_DEV_LOOP)	+= loop.o
 obj-$(CONFIG_BLK_DEV_XD)	+= xd.o
 obj-$(CONFIG_BLK_CPQ_DA)	+= cpqarray.o
drivers/block/ramzswap/ramzswap.c new file +1518 -0

1,518 lines not on this page · raw message

drivers/block/ramzswap/ramzswap.h new file +182 -0

182 lines not on this page · raw message

include/linux/ramzswap_ioctl.h new file +51 -0

51 lines not on this page · raw message