Subject: Re: lazy mlock?
To: None <Richard.Earnshaw@buzzard.freeserve.co.uk>
From: Witold J. Wnuk <witek@wnuk.eu.org>
List: tech-kern
Date: 04/17/2002 10:55:19
On Wednesday 17 April 2002 00:03, you wrote:

> The problem was that ntpd was locking about 6M of RAM (~20%) down and
> killing that solved most of the thrashing issues.  This got me to
> wondering if there was any way to make ntpd kinder to the system: it's
> well known that ntpd has a lot of code that just isn't needed on most
> machines.

Most of this 6MB is stackspace that is never used. On 64MB machine I've added:

Index: ntpd.c
===================================================================
RCS file: /cvsroot/basesrc/dist/ntp/ntpd/ntpd.c,v
retrieving revision 1.2
diff -u -r1.2 ntpd.c
--- ntpd.c      2001/09/16 07:51:55     1.2
+++ ntpd.c      2002/04/17 08:44:16
@@ -642,6 +642,10 @@
               */
        }
 #endif
+       {
+               struct rlimit rl = { 8 * 4096, 8 * 4096 };
+               setrlimit(RLIMIT_STACK, &rl);
+       }

 #if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && defined(MCL_FUTURE)
        /*


afterwards:
root      240  0.0  2.4   712  1548 ??  S<s  29Mar02   3:03.69 /usr/sbin/ntpd

I believe something along the lines should go into the tree.


Same with cdrecord (it's even worse, as I use it on desktop machine that has 
lot higher 'stacksize' limit).


Greetings,


	Witold J. Wnuk