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.

98<br />

Pager window create+access time (s)<br />

0.12<br />

0.1<br />

0.08<br />

0.06<br />

0.04<br />

0.02<br />

mmap + munmap<br />

alloc + copy + free<br />

0<br />

2 4 6 8 10 12 14 16<br />

Disjoint regions<br />

Figure 3.9: Performance <strong>of</strong> page remapping vs. copying. Allocating a<br />

pager window from anonymous memory <strong>and</strong> copying file pages to it for <strong>the</strong> purpose<br />

<strong>of</strong> pageout by <strong>the</strong> vnode pager is faster than remapping memory backed by a file.<br />

Additionally, <strong>the</strong> cost <strong>of</strong> copying is practically independent <strong>of</strong> <strong>the</strong> amount <strong>of</strong> noncontiguous<br />

pages. With remapping, each disjoint region requires a separate call to<br />

mmap().<br />

<strong>The</strong> lowest level memory allocator in NetBSD is <strong>the</strong> UVM kernel memory allocator<br />

(uvm_km). It is used to allocate memory on a pagelevel granularity. <strong>The</strong> st<strong>and</strong>ard implementation<br />

in sys/uvm/uvm_km.c allocates a virtual memory address range <strong>and</strong>,<br />

if requested, allocates physical memory for <strong>the</strong> range <strong>and</strong> maps it in. Since mapping<br />

is incompatible with a rump kernel, we did a straightforward implementation which<br />

allocates a page or contiguous page range with a hypercall.<br />

<strong>The</strong> kmem, pool <strong>and</strong> pool cache allocators are general purpose allocators meant to<br />

be used by drivers. Fundamentally, <strong>the</strong>y operate by requesting pages from uvm_km<br />

<strong>and</strong> h<strong>and</strong>ing memory out in requested size chunks. <strong>The</strong> flow <strong>of</strong> memory between<br />

UVM <strong>and</strong> <strong>the</strong> allocators is dynamic, meaning if an allocator runs out <strong>of</strong> memory, it<br />

will request more from UVM, <strong>and</strong> if <strong>the</strong>re is a global memory shortage, <strong>the</strong> system<br />

will attempt to reclaim cached memory from <strong>the</strong> allocators. We have extracted <strong>the</strong>

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

Saved successfully!

Ooh no, something went wrong!