28.08.2015 Views

The Design and Implementation of the Anykernel and Rump Kernels

1F3KDce

1F3KDce

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

95<br />

to secondary storage so that memory can be reclaimed for o<strong>the</strong>r purposes. Instead <strong>of</strong><br />

requiring a MMU to keep track <strong>of</strong> page usage, we observe that since memory pages<br />

allocated from a rump kernel cannot be mapped into a client’s address space, <strong>the</strong><br />

pages are used only in kernel code. Every time kernel code wants to access a page,<br />

it does a lookup for it using uvm_pagelookup(), uses it, <strong>and</strong> releases <strong>the</strong> reference.<br />

<strong>The</strong>refore, we hook usage information tracking to <strong>the</strong> lookup routine: whenever a<br />

lookup is done, <strong>the</strong> page is deemed as accessed.<br />

3.4.1 Page Remapping<br />

A regular NetBSD kernel has <strong>the</strong> ability to interact with <strong>the</strong> MMU <strong>and</strong> map physical<br />

pages to virtual addresses 8 . Since a rump kernel allocates only anonymous memory<br />

from <strong>the</strong> host, it cannot ask <strong>the</strong> host to remap any <strong>of</strong> its allocations at least on a<br />

POSIX system — <strong>the</strong>re is no interface for mapping anonymous memory in multiple<br />

places. Usermode operating systems typically use a memory mapped file to represent<br />

<strong>the</strong> physical memory <strong>of</strong> <strong>the</strong> virtual kernel [26, 31]. <strong>The</strong> file acts as a h<strong>and</strong>le <strong>and</strong><br />

can be mapped to <strong>the</strong> location(s) desired by <strong>the</strong> usermode kernel using <strong>the</strong> mmap()<br />

system call. <strong>The</strong> DragonFly usermode vkernel uses special host system calls to make<br />

<strong>the</strong> host kernel execute low level mappings [31].<br />

Using a file-backed solution is in conflict with <strong>the</strong> lightweight fundamentals <strong>of</strong> rump<br />

kernels. First, <strong>the</strong> file must be created at a path specified ei<strong>the</strong>r by a configuration<br />

option or by a system guess. Fur<strong>the</strong>rmore, it disrupts <strong>the</strong> dynamic memory principle<br />

we have laid out. While it is relatively simple to extend <strong>the</strong> file to create more<br />

memory on dem<strong>and</strong>, it is difficult to truncate <strong>the</strong> file in case <strong>the</strong> memory is no longer<br />

needed because free pages will not automatically reside in a contiguous range at<br />

<strong>the</strong> end <strong>of</strong> <strong>the</strong> file. Finally, <strong>the</strong> approach requires virtual memory mapping support<br />

from <strong>the</strong> host <strong>and</strong> limits <strong>the</strong> environments a rump kernel can be <strong>the</strong>oretically hosted<br />

8 NetBSD itself does not run on hardware without a MMU.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!