Date: Fri, 11 Oct 2013 09:57:24 +0400 From: Dmitry Sivachenko <trtrmitya@gmail.com> To: Konstantin Belousov <kostikbel@gmail.com> Cc: "hackers@freebsd.org" <hackers@freebsd.org> Subject: Re: mmap() question Message-ID: <A5E3C0A2-F0D5-47B1-8992-4B9DA347C275@gmail.com> In-Reply-To: <20131011051702.GE41229@kib.kiev.ua> References: <95E0B821-BF9B-4EBF-A1E5-1DDCBB1C3D1B@gmail.com> <20131011051702.GE41229@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On 11.10.2013, at 9:17, Konstantin Belousov <kostikbel@gmail.com> wrote: > On Wed, Oct 09, 2013 at 03:42:27PM +0400, Dmitry Sivachenko wrote: >> Hello! >>=20 >> I have a program which mmap()s a lot of large files (total size more = that RAM and I have no swap), but it needs only small parts of that = files at a time. >>=20 >> My understanding is that when using mmap when I access some memory = region OS reads the relevant portion of that file from disk and caches = the result in memory. If there is no free memory, OS will purge = previously read part of mmap'ed file to free memory for the new chunk. >>=20 >> But this is not the case. I use the following simple program which = gets list of files as command line arguments, mmap()s them all and then = selects random file and random 1K parts of that file and computes a XOR = of bytes from that region. >> After some time the program dies: >> pid 63251 (a.out), uid 1232, was killed: out of swap space >>=20 >> It seems I incorrectly understand how mmap() works, can you please = clarify what's going wrong? >>=20 >> I expect that program to run indefinitely, purging some regions out = of RAM and reading the relevant parts of files. >>=20 >=20 > You did not specified several very important parameters for your test: > 1. total amount of RAM installed 24GB > 2. count of the test files and size of the files To be precise: I used 57 files with size varied form 74MB to 19GB. The total size of these files is 270GB. > 3. which filesystem files are located at UFS @ SSD drive > 4. version of the system. FreeBSD 9.2-PRERELEASE #0 r254880M: Wed Aug 28 11:07:54 MSK 2013=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A5E3C0A2-F0D5-47B1-8992-4B9DA347C275>