Dataspace juju

Norman Feske norman.feske at ...1...
Wed Jul 10 22:05:03 CEST 2013


Hello,

>> From my understanding it's a mapping optimization for some kernels.
>> Something like: mapping 64M to another task can be done with one
> syscall if the address has 64M alignment. But I'm not familiar with
> the details, perhaps somebody else can help out here?

we use natural alignments for both allocations of physical memory and
allocations of virtual memory in order to increase the likelihood for
large-page mappings. Using large mappings has several benefits:

* On most L4-like kernels such as NOVA, a page fault can be answered
  with a so-called flexpage that can have an arbitrary power-of-two
  size. Because each mapping creates a node in the in-kernel mapping
  database, the use of a few large-page mappings consumes less kernel
  memory than the use of many small-page mappings.

* On CPU architectures with support for different page sizes, the use
  of large pages reduces the TLB footprint and the number of page-
  fault exceptions. But large page sizes can be used only if large
  mappings are used. Therefore, large mappings should be preferred over
  small mappings to enable the kernel to actually make use of large
  pages.

* Even if a CPU architecture supports only a few page sizes (i.e.,
  x86), using large mappings has the benefit that the kernel can
  populate page tables for a large range of virtual memory (covered
  by a single mapping) without invoking the user-level page-fault
  protocol. This can happen eagerly or on-demand, whatever the
  kernel developers prefer. In contrast, if we would resolve each
  page fault via a measly 4K mapping, the kernel had no room
  for such optimizations.

However, for large-page mappings to work, some conditions with regard to
the alignment of the mapping source and destination must be met. I.e.,
in order to use superpages on x86, both the physical address of the
backing store as well as the virtual address must be aligned to a 4 MiB
boundary. For this reason, Genode's core tries to use natural alignments
for both the allocation of physical memory ('Ram_session::alloc') as
well as virtual memory ('Rm_session::attach'). If no free address range
that meets those conditions exists, core successively weakens the
condition (see the implementation of 'Rm_session::attach' in
'base/src/core/rm_session_component.cc').

Best regards
Norman

-- 
Dr.-Ing. Norman Feske
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth




More information about the users mailing list