Re: superpages in FreeBSD (netmap related) ?

From: Marko Zec <zec_at_fer.hr>
Date: Mon, 1 Jun 2015 11:54:11 +0200
On Mon, 1 Jun 2015 11:34:00 +0200
Luigi Rizzo <rizzo_at_iet.unipi.it> wrote:

> Hi,
> i was wondering how we can improve the netmap memory allocator
> to make use of 2M pages (through the page promotion trick).
> 
> in netmap, when we allocate packet buffers,
> we issue requests for 4k blocks to contigmalloc(),
> and i have no idea if there is a way to improve the
> chance that the memory is mapped to 2M pages ?

In my (previous life) experience, when requested large enough blocks,
malloc() did a good job at automatically promoting those to superpages,
and in my applications this behavior was 100% consistent, at least on
amd64.  After the block is allocated one can check whether it is
superpage-mapped:

pmap_t pmap = vmspace_pmap(curthread->td_proc->p_vmspace);

if (pmap_mincore(pmap, (vm_offset_t) addr) & MINCORE_SUPER)
	/* you're good */
else
	/* bad luck */

OTOH I'm not aware of any mechanisms for forcing superpage allocations
at malloc() time.

Marko
Received on Mon Jun 01 2015 - 07:54:47 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:58 UTC