Date: Mon, 23 Jun 2014 14:00:37 +0400 From: Dmitry Sivachenko <trtrmitya@gmail.com> To: hackers@freebsd.org Subject: Re: mlock() and vm_max_wired Message-ID: <C187B4D5-7D29-426F-BF90-06CFB023B702@gmail.com> In-Reply-To: <D85BD1F5-414C-45FA-B509-C55DC9BE125A@gmail.com> References: <D85BD1F5-414C-45FA-B509-C55DC9BE125A@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 23 =D0=B8=D1=8E=D0=BD=D1=8F 2014 =D0=B3., at 13:52, Dmitry Sivachenko = <trtrmitya@gmail.com> wrote: > Hello! >=20 > I am using FreeBSD-10/stable and have a problem with mlock(). > I have 256GB of memory and a program which does mmap+mlock on a number = of data files. It can process one file several times (so it does mmap() = + mlock() on the same file more than once). > I set vm.max_wired=3D67108864 (67108864 * 4k =3D 256GB), so it is = allowed to mlock() the whole RAM. >=20 > The total size of all files is about 180GB. >=20 > The program fails with mlock: Resource temporarily unavailable error. >=20 > If I increase vm.max_wired even more, the program works fine and after = it starts top(1) shows about 186GB of Wired memory. >=20 > Why does it fail with vm.max_wired=3D67108864? Is it a bug or am I = missing something? >=20 > Thanks. Forgot to add the I suspect the following fragment in vm_mmap.c, in = vm_mlock() function: if (npages + cnt.v_wire_count > vm_page_max_wired) return (EAGAIN); If we mlock() the same region second time, this condition can be true = though after mlock() these pages will not increase total locked pages = counter.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C187B4D5-7D29-426F-BF90-06CFB023B702>