fs: Use cache=none by default

The cache= option from the virtiofsd backend is meant to be used
depending on how the user wants to use the guest page cache. For most
use cases, we want to bypass the guest page cache to reduce the guest
memory footprint, which is why "cache=none" should be the default.

"cache=always" is the other option when the user wants to do something
specific by using the guest page cache, but should not be the default
anymore.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2020-01-07 18:26:40 +01:00
parent 84445aae93
commit ad223f2b50
2 changed files with 6 additions and 6 deletions

View File

@ -28,12 +28,12 @@ _Run virtiofsd_
-d \
-o vhost_user_socket=/tmp/virtiofs \
-o source=/tmp/shared_dir \
-o cache=always
-o cache=none
```
The `cache=always` option should be the default when using `virtiofsd` with the __cloud-hypervisor__ VMM. This allows the daemon to memory map the shared files, which gives better I/O performance.
The `cache=none` option should be the default when using `virtiofsd` with the __cloud-hypervisor__ VMM. This prevents from using the guest page cache, which reduces the memory footprint of the guest. When running multiple virtual machines on the same host, this will let the host deal with page cache, which will increase the density of virtual machines which can be launched.
The `cache=none` option is another way to run the daemon but because the _virtqueues_ are used to convey the files content in this case, the I/O performance is impacted.
The `cache=always` option will allow for the guest page cache to be used, which will increase the memory footprint of the guest. This option should be used only for specific use cases where a single VM is going to be running on a host.
### The kernel

View File

@ -2935,12 +2935,12 @@ mod tests {
#[cfg_attr(not(feature = "mmio"), test)]
fn test_virtio_fs_dax_on_default_cache_size() {
test_virtio_fs(true, None, "always", &prepare_virtiofsd)
test_virtio_fs(true, None, "none", &prepare_virtiofsd)
}
#[cfg_attr(not(feature = "mmio"), test)]
fn test_virtio_fs_dax_on_cache_size_1_gib() {
test_virtio_fs(true, Some(0x4000_0000), "always", &prepare_virtiofsd)
test_virtio_fs(true, Some(0x4000_0000), "none", &prepare_virtiofsd)
}
#[cfg_attr(not(feature = "mmio"), test)]
@ -3507,7 +3507,7 @@ mod tests {
let vfio_tap2 = "vfio-tap2";
let (mut daemon_child, virtiofsd_socket_path) =
prepare_virtiofsd(&guest.tmp_dir, vfio_path.to_str().unwrap(), "always");
prepare_virtiofsd(&guest.tmp_dir, vfio_path.to_str().unwrap(), "none");
let mut child = Command::new("target/release/cloud-hypervisor")
.args(&["--cpus", "boot=4"])