Locking kdecore into memory

Lubos Lunak l.lunak at suse.cz
Tue Jan 23 17:03:13 GMT 2007

On Monday 22 January 2007 08:31, subbukk wrote:
> On Monday 22 January 2007 05:31, Stefan Teleman wrote:
> > On Sunday 21 January 2007 17:25, Richard Moore wrote:
> > > On 1/21/07, Lubos Lunak <l.lunak at suse.cz> wrote:
> > >
> > > So we have some sort of kdeinit like process that runs setuid and
> > > calls mlockall()? That would be able to lock the libraries into ram
> > > I guess. To be useful though, how much would we have to lock?
> > > kdecore, kdelibs, qt, X11 and libc I guess. That's quite a bit.
> >
> > A lot. :-)
> True. Pinning all of kdecore into RAM is an overkill as many of its pages
> may be used rarely or not at all.

 Not all of it, just what's used. I think mlockall( MCL_CURRENT ) at a 
suitable place should do. Besides, 30M is hardly a lot with today's machines, 
I'd gladly give it if I knew I'll never ever see this 1G machine dead for 
minutes or rather even tens of them.

> If a page is frequently used, the OS 
> will leave it in RAM page frame anyway. If it does get paged out, there
> isnt sufficient RAM for all active jobs. In such a case. I would rather
> boost my compile speed by shutting down X and background services than
> keep my K* apps up. Why should KDE (or any other user app) be allowed to
> pin down scarce page frames unconditionally?

 Because this all is just a nice theory but practice differs. It's no big deal 
to render this 1G machine with no swap unusable for ten minutes by running 
out of memory by mistake. We already have workarounds for deficiencies in 
other parts of the system, so why not try also here?

 Note that all this is still just theory as far as I am concerned, until 
somebody actually tries it.

> I don't think the case for overriding the vm paging logic is sufficiently
> strong. It goes against the Separation of Concerns Principle in design.
> If Linux OOM logic is weak, it would be better to get it fixed than to
> have KDE work guess around it.

 Good luck. Seriously.

Lubos Lunak
KDE developer
SUSE LINUX, s.r.o.   e-mail: l.lunak at suse.cz , l.lunak at kde.org
Lihovarska 1060/12   tel: +420 284 028 972
190 00 Prague 9      fax: +420 284 028 951
Czech Republic       http//www.suse.cz

More information about the kde-core-devel mailing list