This extension of linux provides some additional features in linux that facilitates large systems to efficient process in-memory data.
The vmcopy()
implementation provides an efficient way to replicate main-memory data. It can replace an expensive malloc() and memcpy()
operation to copy data virtually instead of creating physical copy. The copy created by vmcopy()
are managed by linux kernel, and is detached from original using copy-on-write (if data is backed by private anonymous memory). The copy retains the properties of original virtual memory area.
Actual linux documentation is available in Documentation/admin-guide/README.rst
Commit hash of first commit 48c0dcc537 (needed to create a patch).
sudo apt-get install git build-essential kernel-package fakeroot libncurses5-dev libssl-dev ccache bison flex
SYSCALL_NR 333
void* vmcopy(void* src, unsigned long length);
// use syscall defined in unistd.h to invoke the system call or,
// use the header file (anker.h) defined in rapido/tests/include/
void *copy = syscall(333, src, length);
- Use
make menuconfig
to generate a.config
file. - Enable transparent hugepages by editing
.config
file.
- Set
CONFIG_TRANSPARENT_HUGEPAGE=y
andCONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y
. - These options are necessary to run the tests specified under rapido/tests/src/
- Enable
vmcopy()
by settingCONFIG_ANKER_VMCOPY=y
. - Currently
TRANSPARENT_HUGEPAGE
must be enabled to usevmcopy()
.
This kernel was developed using the testbed backed by Qemu
. I have used a trimmed down version of Rapido that provides a set of scripts to quicky generate VM Image
and necessary modules using Dracut and boots the image using Qemu
.
- Generate relevant configure file as mentioned above.
- make -j
- INSTALL_MOD_PATH=./mods make modules_install
cd rapido/tests
cmake -DCMAKE_CXX_FLAGS=-O2 .
make -j4
cd ..
./cut_anker.sh
- Boot the
VM
using./vm.sh
. - Tests are installed in path
/tests/
inside the VM. - Use
shutdown
to powerdown theVM
.
- Create patch using
diff
.
diff -uNr linux.vanilla linux.new > patchfile
- Apply patch using
patch
.
cd linux && patch -p1 < ../patchfile
echo 2048 > /proc/sys/vm/nr_hugepages
mkdir -p /mnt/hugetlbfs
chown -R user:group /mnt/hugetlbfs
mount -t hugetlbfs -o uid=<userid>,gid=<groupid>,pagesize=2M,size=4G,nr_inodes=1024 none /mnt/hugetlbfs
The code and technology is free for academic use. For commercial use, contact [email protected]