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.

99<br />

implementations for <strong>the</strong>se allocators from <strong>the</strong> st<strong>and</strong>ard NetBSD kernel <strong>and</strong> provide<br />

<strong>the</strong>m as part <strong>of</strong> <strong>the</strong> rump kernel base.<br />

An exception is <strong>the</strong> 4.3BSD/4.4BSD malloc() [73]; we stress that in this section<br />

malloc refers to <strong>the</strong> in-kernel implementation <strong>of</strong> <strong>the</strong> allocator. In contrast to <strong>the</strong><br />

dynamic nature <strong>of</strong> <strong>the</strong> abovementioned allocators, <strong>the</strong> malloc implementation uses<br />

a single contiguous memory range for all allocations (kmem_map). <strong>The</strong> size <strong>of</strong> this<br />

range is calculated from total system memory <strong>and</strong> <strong>the</strong> range is allocated at system<br />

bootstrap time. In a rump kernel this behavior is not desirable, since it sets static<br />

limits for <strong>the</strong> system. Due to this reason we did not extract malloc <strong>and</strong> instead<br />

reimplemented <strong>the</strong> interface by relegating requests to <strong>the</strong> hypercall layer. Since<br />

malloc is being retired in NetBSD in favor <strong>of</strong> <strong>the</strong> newer style allocators, we did not<br />

see it necessary to spend effort on being able to extract <strong>the</strong> implementation instead<br />

<strong>of</strong> using <strong>the</strong> hypervisor’s memory allocator directly. Notably, <strong>the</strong> situation with<br />

malloc may need to be revisited if rump kernels are to be ported to a host which<br />

does not provide a general purpose memory allocator in itself <strong>and</strong> malloc is not fully<br />

retired by <strong>the</strong>n.<br />

3.4.3 Pagedaemon<br />

<strong>The</strong> NetBSD kernel uses idle memory for caching data. As long as free memory is<br />

available, it will be used for caching. <strong>The</strong> pagedaemon serves <strong>the</strong> purpose <strong>of</strong> pushing<br />

out unnecessary data to recycle pages when memory is scarce. A mechanism is<br />

required to keep long-running rump kernels from consuming all memory available<br />

from <strong>the</strong> host for caching. <strong>The</strong> choices are to ei<strong>the</strong>r eliminate caching <strong>and</strong> free<br />

memory immediately after it has been used, or to create a pagedaemon which can<br />

operate despite memory access information not being available with <strong>the</strong> help <strong>of</strong> a<br />

MMU. Since eliminating caching is undesirable for performance reasons, we chose<br />

<strong>the</strong> latter option.

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

Saved successfully!

Ooh no, something went wrong!