28.08.2015 Views

The Design and Implementation of the Anykernel and Rump Kernels

1F3KDce

1F3KDce

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

100<br />

A rump kernel can be configured with ei<strong>the</strong>r a specified amount <strong>of</strong> memory or an<br />

unlimited amount <strong>of</strong> memory. In <strong>the</strong> former case <strong>the</strong> rump kernel will disallow<br />

runtime memory allocations going over <strong>the</strong> limit. When 90% <strong>of</strong> <strong>the</strong> allocation limit<br />

has been reached, <strong>the</strong> pagedaemon will be invoked to push out memory content<br />

which has not been used recently. If no limit is specified, a rump kernel can grow<br />

up to potentially consuming all memory <strong>and</strong> swap space on <strong>the</strong> host. <strong>The</strong> latter is<br />

<strong>the</strong> default, since in our experience it suits all but a few use cases. For example,<br />

in virtually all unit test use cases <strong>the</strong> memory limit has no consequence, since a<br />

short-lived rump kernel will not have a chance to grow large enough for it to matter.<br />

Fur<strong>the</strong>rmore, a POSIX per-process memory size limit (rlimit) will usually be hit<br />

before one process can have a serious impact on <strong>the</strong> host. Hitting this limit causes<br />

<strong>the</strong> memory allocation hypercall to fail. If <strong>the</strong> memory allocation hypercall fails,<br />

<strong>the</strong> rump kernel treats <strong>the</strong> situation <strong>the</strong> same as reaching <strong>the</strong> s<strong>of</strong>t-configured limit<br />

<strong>and</strong> invokes <strong>the</strong> pagedaemon, which will hopefully flush out <strong>the</strong> cache <strong>and</strong> allow <strong>the</strong><br />

current allocation to succeed.<br />

To free memory, <strong>the</strong> pagedaemon must locate memory resources which are not in<br />

use <strong>and</strong> release <strong>the</strong>m. <strong>The</strong>re are fundamentally two types <strong>of</strong> memory: pageable <strong>and</strong><br />

wired.<br />

• Pageable memory means that a memory page can be paged out. Paging<br />

is done using <strong>the</strong> pager construct that <strong>the</strong> NetBSD VM (UVM) inherited<br />

from <strong>the</strong> Mach VM [99] via <strong>the</strong> 4.4BSD VM. A pager has <strong>the</strong> capability to<br />

move <strong>the</strong> contents <strong>of</strong> <strong>the</strong> page in <strong>and</strong> out <strong>of</strong> secondary storage. NetBSD<br />

currently supports three classes <strong>of</strong> pagers: anonymous, vnode <strong>and</strong> device.<br />

Device pagers map device memory, so <strong>the</strong>y can be left out <strong>of</strong> a discussion<br />

concerning RAM. We extract <strong>the</strong> st<strong>and</strong>ard UVM anonymous memory object<br />

implementation (sys/uvm/uvm_aobj.c) mainly because <strong>the</strong> tmpfs file system<br />

requires anonymous memory objects. However, we compile uvm_aobj.c<br />

without defining VMSWAP, i.e. <strong>the</strong> code for support moving memory to <strong>and</strong>

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

Saved successfully!

Ooh no, something went wrong!