linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC] vswap: virtio based swap device
@ 2010-01-03  0:24 Nitin Gupta
  0 siblings, 0 replies; only message in thread
From: Nitin Gupta @ 2010-01-03  0:24 UTC (permalink / raw)
  To: Dan Magenheimer; +Cc: tmem-devel, linux-mm

virtio_vswap driver[1] creates /dev/vswap device which can
be used (only) as a swap disk. Pages swapped to this device
are send directly to host/hypervisor. The host, depending on
various policies, can fail this request in which case the driver
writes the page to guest controlled swap partition (backing_swap
module parameter provides this partition). The size of this
device is set equal to that of backing_swap.

This driver provides an alternate approach for "preswap"
introduced as part of "tmem" patches posted earlier:
http://lwn.net/Articles/338098/
These patches used Xen specific interfaces and made some
intrusive changes to swap code. However, I found the concept
interesting, so developed this virtio based driver which does
not require any kernel changes.

It uses virtio to create a virtual PCI device and also creates
a virtual block device (/dev/vswap) whose only job is to send
pages to host and if that fails, forward request to backing_swap.
It also requires changes to qemu-kvm[2] to expose this virtual
PCI device to guest and is enabled with '-vswap virtio' option.

In current state, it does everything except actually storing
incoming guest pages in host memory :)  Also, it uses a single
virtqueue which sends each page to host synchronously.  Its just
a proof of concept code to show how virtio framework can be used
to drive such a device. Perhaps a more interesting application would
be an FS-cache backend that sends pages to host as clean pagecache
usually occupies a vast majority of memory and ballooning is too slow
to deal quickly with such large caches when the host is running into
memory pressure.

[1] vswap kernel driver:
http://code.google.com/p/compcache/source/browse/sub-projects/vswap/

[2] qemu-kvm patch to expose vswap PCI device:
http://code.google.com/p/compcache/source/browse/sub-projects/vswap/qemu_kvm_vswap_support.patch

[3] Transcendent Memory (tmem) project page:
http://oss.oracle.com/projects/tmem/

(I intend to merge vswap with ramzswap driver which is already
in mainline, so I did not integrate it with kernel build system.
So, provided just the link to code instead of diff against /dev/null)

Thanks,
Nitin

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-03  0:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-03  0:24 [RFC] vswap: virtio based swap device Nitin Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).