Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 02 Nov 2012 16:48:38 +0200
From:      Andriy Gapon <avg@FreeBSD.org>
To:        Andrey Zonov <zont@FreeBSD.org>
Cc:        freebsd-arch@FreeBSD.org
Subject:   Re: unprivileged mlock(2)
Message-ID:  <5093DD46.1040701@FreeBSD.org>
In-Reply-To: <5093D771.5040606@FreeBSD.org>

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

[-- Attachment #1 --]
on 02/11/2012 16:23 Andrey Zonov said the following:
> Hi,
> 
> I'm ready to commit these four patches [1].  I'm going to do this
> tomorrow if there won't be any objections.
> 
> I want to make clear changes in login.conf about memorylocked limits.
> When the system is starting up, init(8) uses daemon login class to run
> /etc/rc.  Some daemons such as amd(8) and watchdogd(8) use mlockall(2)
> and may deny that call because of limits, that is why I set memorylocked
> limit to 64Mb for daemon class.
> 
> But the problem will be still there if you are using `sudo' or `su -m'
> to restart services.  In that case your login class (and limits) would
> be applied and memorylocked limit may cause failure of mlockall(2) call
> (like vmemoryuse limit may fail malloc(3)).
> 
> [1] http://people.freebsd.org/~zont/patches/mlock/
> 

I would start with memorylocked=64k or 128k for the default class.
I can't justify these numbers excepts that they are nice :-) and 8MB "feels" like
too much.
Anything greater than zero would already be an improvement and typical
unprivileged applications that want wired memory usually request a single page.
So several pages should be enough.
Those who would need more can always bump the limit in the local config.

P.S. Not sure if it would be better to set memorylocked=unlimited for the daemon
class too.  I think that in the default configuration it's only super-user who can
use that class.

-- 
Andriy Gapon


[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQk91iAAoJEHSlLSemUf4vOJMH/jIJcR6EFSAJvpCT8l5uf/eE
g0CpmcRy5lbXFxUYFTviHH15S4yj2yG4B22Dn3kbaMm4tTHNbfia5Rbg8nBmopJ6
MvBHd8l/nYa2hC/JowvwjeZz8BwsNjkYkR6B1RzHcxC5GFcP9M99Ax8KbVSc2Z8z
TNzJVgZWQQvC0n8/HrRpR+6PZY6XEn9gUFQFCJNJu9A5WQsTIiDqqopX/skpxgzv
Z3ipe4dtLTTnsBjmgeJSuxWeRQDVWJG4dF0vvR2ZlYtzmJz67OYL8RSPypeZAC4S
sJ373nx7+3/Ekt6tVGTYXXGwpWqvphIsLaQXtk3FprCy/75RTi4c4bdfbbTkThc=
=LphE
-----END PGP SIGNATURE-----
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5093DD46.1040701>