Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Mar 2014 16:03:04 +0400
From:      Dmitry Sivachenko <trtrmitya@gmail.com>
To:        =?utf-8?Q?Trond_Endrest=C3=B8l?= <Trond.Endrestol@fagskolen.gjovik.no>
Cc:        hackers@freebsd.org
Subject:   Re: madvise() vs posix_fadvise()
Message-ID:  <C5489EF2-34D8-412C-88AC-476120D3F1F4@gmail.com>
In-Reply-To: <alpine.BSF.2.00.1403211725140.56113@mail.fig.ol.no>
References:  <D6BD48AF-9522-495D-8D54-37854E53C272@gmail.com> <alpine.BSF.2.00.1403211725140.56113@mail.fig.ol.no>

next in thread | previous in thread | raw e-mail | index | archive | help

On 21 =D0=BC=D0=B0=D1=80=D1=82=D0=B0 2014 =D0=B3., at 20:27, Trond =
Endrest=C3=B8l <Trond.Endrestol@fagskolen.gjovik.no> wrote:

> On Fri, 21 Mar 2014 18:56+0400, Dmitry Sivachenko wrote:
>=20
>> Hello!
>>=20
>> I have a program which uses large data files (read-only, via mmap()).
>>=20
>> These machines have a bit more RAM that these files occupy, so it is=20=

>> possible to have all these data in memory.
>>=20
>> What techniques should I use to promote this data not to be purged=20
>> from RAM:
>>=20
>> -- madvise(MADV_WILLNEED)
>> -- posix_fadvise(POSIX_FADV_WILLNEED)
>> -- both?
>=20
> Although a bit dangerous, mlock(2) might be your ticket. That system=20=

> call prevents your memory region from being swapped/paged away from=20
> physical memory.
>=20


I know about mlock(2), it is a bit overkill.
Can someone please explain the difference between madvise(MADV_WILLNEED) =
and posix_fadvise(POSIX_FADV_WILLNEED)?





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C5489EF2-34D8-412C-88AC-476120D3F1F4>