Locking kdecore into memory

Cyrille Berger cberger at cberger.net
Fri Jan 19 13:40:26 GMT 2007


On Friday 19 January 2007 14:22, Arnold Krille wrote:
> Am Freitag, 19. Januar 2007 14:06 schrieb Richard Moore:
> > On 1/19/07, John Tapsell <johnflux at gmail.com> wrote:
> > >  What if we lock the main kde libraries into memory (so they can't
> > > swap out) when the user is running a kde desktop?  This would only be
> > > about 20MB or so.
> >
> > IIRC mlock is only available as root so we can't do that.
>
> It definitely isn't. All jack-applications (professional low-latency-audio)
> uses mlock without being root.
>
> Arnold
from mlock manpage:
LINUX NOTES
 Under Linux, mlock() and munlock() automatically round addr down to the 
nearest page boundary. However, POSIX 1003.1-2001 allows an implementation to 
require that addr is page aligned, so portable applications should ensure 
this. 
Limits and permissions
 In Linux 2.6.8 and earlier, a process must be privileged (CAP_IPC_LOCK) in 
order to lock memory and the RLIMIT_MEMLOCK soft resource limit defines a 
limit on how much memory the process may lock. 
 Since Linux 2.6.9, no limits are placed on the amount of memory that a 
privileged process can lock and the RLIMIT_MEMLOCK soft resource limit 
instead defines a limit on how much memory an unprivileged process may lock. 


And greping through my /usr/include, it seems that RLIMIT_MEMLOCK is set to 8, 
but for confirmation it would be better to look in the linux kernel source 
code.

-- 
Cyrille Berger




More information about the kde-core-devel mailing list