Skip to content

ljishen/nofscache

Repository files navigation

nofscache

A loadable kernel moduel trying to eliminating page caching effects for user applications.

Requirements

  • Linux kernel version >= 4.12
  • Having CONFIG_ADVISE_SYSCALLS=y in /boot/config-$(shell uname -r)
  • This module affects only 64-bit userspace programs since we didn't patch the compatibility version of system calls (compat_sys_xyzzy()).

Installation

git clone https://github.com/ljishen/nofscache.git
cd nofscache
make install

If you keep seeing processes under

[INFO] Checking transition state for module no_fscache (update every 2s)...

[INFO] 2 tasks are not in patched state:
USER       PID   TID CMD
root      1040  1131 /usr/bin/lxcfs /var/lib/lxcfs/
root      1040  1133 /usr/bin/lxcfs /var/lib/lxcfs/

...

You may need to manually kill these processes because they are stopping the module from finishing the transition state from unpatched to patched. See livepatch consistency model for more details.

To uninstall the kernel module, use

make uninstall

Again, you may need to kill processes to help the module finish the transition state from patched to unpatched.

Limitations and Performance Results

See https://ljishen.github.io/nofscache/ for more details.

How to start the Vagrant testing environment

This repository contains a Vagrantfile used to start an Ubuntu 18.04.3 LTS environment for testing.

  1. Download and install Vagrant

    curl -s https://releases.hashicorp.com/vagrant/2.2.5/vagrant_2.2.5_x86_64.deb -o /tmp/vagrant_x86_64.deb
    sudo dpkg -i /tmp/vagrant_x86_64.deb
  2. This Vagrant environment uses the libvirt provider. We need to have all the build dependencies installed in order to use vagrant-libvirt

    sudo apt-get update
    sudo apt-get -y install qemu libvirt-bin ebtables dnsmasq-base
    sudo apt-get -y install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
  3. Add your user to the "libvirt" group. Remember that you will have to log out and back in for this to take effect!

    sudo usermod -aG libvirt $USER
  4. You're ready to install vagrant-libvirt using standard Vagrant plugin installation methods

    vagrant plugin install vagrant-libvirt
  5. Install NFS server since we use NFS to set up synced folders

    sudo apt-get -y install nfs-kernel-server
  6. Start the Vagrant environment

    git clone https://github.com/ljishen/nofscache
    cd nofscache
    vagrant up
  7. Connect to the virtual machine via SSH

    vagrant [-X] ssh

    or via serial console

    virsh console "$(virsh list --state-running --name | grep nofscache)"
    • Use vagrant -X ssh to connect with X11 forwarding enabled.
    • The default user is vagrant with password vagrant. To exit a virsh console session, type Ctrl+].

Troubleshooting

  • If you see something like the following error during vagrant up:

    ==> default: Mounting NFS shared folders...
    The following SSH command responded with a non-zero exit status.
    Vagrant assumes that this means the command failed!
    
    mount -o vers=3,udp,rw,vers=3,tcp,actimeo=2 192.168.121.1:/users/ljishen/nofscache /vagrant
    
    Stdout from the command:
    
    
    
    Stderr from the command:
    
    mount.nfs: access denied by server while mounting 192.168.121.1:/users/ljishen/nofscache

    Try to add this rule to file /etc/hosts.allow

    $ echo "rpcbind: 192.168.121." >> /etc/hosts.allow

    As the default management_network_address used by vagrant-libvirt is 192.168.121.0/24. See management_network_address for more details.

Miscellaneous