Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Apr 2014 15:29:03 +0400
From:      Dmitry Sivachenko <trtrmitya@gmail.com>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        freebsd-hackers@freebsd.org, =?utf-8?Q?Trond_Endrest=C3=B8l?= <Trond.Endrestol@fagskolen.gjovik.no>
Subject:   Re: madvise() vs posix_fadvise()
Message-ID:  <0AF273E6-CD43-417C-A00C-5B7445090D5B@gmail.com>
In-Reply-To: <201403271141.41487.jhb@freebsd.org>
References:  <D6BD48AF-9522-495D-8D54-37854E53C272@gmail.com> <alpine.BSF.2.00.1403211725140.56113@mail.fig.ol.no> <C5489EF2-34D8-412C-88AC-476120D3F1F4@gmail.com> <201403271141.41487.jhb@freebsd.org>

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

On 27 =D0=BC=D0=B0=D1=80=D1=82=D0=B0 2014 =D0=B3., at 19:41, John =
Baldwin <jhb@FreeBSD.org> wrote:
>>=20
>> I know about mlock(2), it is a bit overkill.
>> Can someone please explain the difference between =
madvise(MADV_WILLNEED) and=20
> posix_fadvise(POSIX_FADV_WILLNEED)?
>=20
> Right now FADV_WILLNEED is a nop.  (I have some patches to implement =
it for
> UFS.)  I can't recall off the top of my head if MADV_WILLNEED is also =
a nop.
> However, if both are fully implemented they should be similar in terms =
of
> requesting async read-ahead.  MADV_WILLNEED might also conceivably
> pre-create PTEs while FADV_WILLNEED can be used on a file that isn't
> mapped but is accessed via read(2).
>=20


Hello and thanks for your reply.

Right now I am facing the following problem (stable/10):
There is a (home-grown) webserver which mmap's a large amount of data =
files (total size is a bit below of RAM, say ~90GB of files with 128GB =
of RAM).
Server writes access.log (several gigabytes per day).

Some of mmaped data files are used frequently, some are used rarely. On =
startup, server walks through all of these data files so it's content is =
read from disk.

After some time of running, I see that rarely used data files are purged =
from RAM (access to them leads to long-running disk reads) in favour of =
disk cache
(at 0:00, when I rotate and gzip log file I see Inactive memory goes =
down to the value of log file size).

Is there any way to tell VM system not to push mmap'ed regions out of =
RAM in favour of disk caches?




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0AF273E6-CD43-417C-A00C-5B7445090D5B>