Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Jun 2015 12:11:12 +0200
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        Marko Zec <zec@fer.hr>
Cc:        FreeBSD Current <current@freebsd.org>, Giuseppe Lettieri <g.lettieri@iet.unipi.it>,  Stefano Garzarella <stefanogarzarella@gmail.com>, Vincenzo Maffione <v.maffione@gmail.com>, Luigi Rizzo <rizzo@iet.unipi.it>
Subject:   Re: superpages in FreeBSD (netmap related) ?
Message-ID:  <CA%2BhQ2%2BhkWth=obecWzuXdfESeRXhGdzng7_Mj0g3HkMo=oyWNQ@mail.gmail.com>
In-Reply-To: <20150601115411.1f95bd00@x23>
References:  <CA%2BhQ2%2BiWq4rO-V0M9VZTHMcVORSJ_Qgn6u0JmSiZjTy-L2MAsQ@mail.gmail.com> <CA%2BhQ2%2Bh7LZp2cLUpOrqLvWwFmSSWSw4GKT1DJCc_AuH7-t042g@mail.gmail.com> <20150601115411.1f95bd00@x23>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday, June 1, 2015, Marko Zec <zec@fer.hr> wrote:

> On Mon, 1 Jun 2015 11:34:00 +0200
> Luigi Rizzo <rizzo@iet.unipi.it <javascript:;>> 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 */


Thanks. Do you know if there is any way to run some equivalente test from
user space ?

Cheers
Luigi


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


-- 
-----------------------------------------+-------------------------------
 Prof. Luigi RIZZO, rizzo@iet.unipi.it  . Dip. di Ing. dell'Informazione
 http://www.iet.unipi.it/~luigi/        . Universita` di Pisa
 TEL      +39-050-2217533               . via Diotisalvi 2
 Mobile   +39-338-6809875               . 56122 PISA (Italy)
-----------------------------------------+-------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BhQ2%2BhkWth=obecWzuXdfESeRXhGdzng7_Mj0g3HkMo=oyWNQ>