[ntp:questions] Re: Locking memory in ntp

Michael Sierchio kudzu at tenebras.com
Fri Sep 26 21:43:36 UTC 2003


David Schwartz wrote:
> "Michael Sierchio" <kudzu at tenebras.com> wrote in message
> news:peGdnSIEpemHyemiRVn-iw at speakeasy.net...
> 
> 
>>Maarten Wiltink wrote:
> 
> 
>>>Gopal wrote in message ...
> 
> 
>>>>Ntpd has a mlockall() function call which locks all the current and
>>>>future memory.  Why do we need to lock the memory.
> 
> 
>>>To prevent page faults, which can cause unnecessary variation in
>>>the response time to receiving timestamps.
> 
> 
>>Does it help to point out that mlockall() is a wish and a prayer?
>>There are per-process and per-machine limits on how many pages
>>may be locked in memory...
> 
> 
>>IOW the only guaranteed way of locking all pages in physmem is
>>to run without swap.
> 
> 
>     Running without swap doesn't guarantee that. In fact, it increases the
> chances that pages will be discarded because rarely-used modified pages from
> other programs can't be swapped out.

No, pages will not be discarded, though processes will be selected
for termination upon an attempt to access allocated pages that are
not mapped to pmem.  (at least in the BSD universe)

But it's easy enough to set process limits so that this never
happens, and that errant daemons get killed and restarted.  I have
a stratum 1 server based on a net4501, you can't get any more
"no swap" than that.

You shouldn't be running anything (other than essentials) on
an ntp reference server anyway -- and if your desktop machine
pages out memory belonging to ntpd?  Frankly, my dear, I don't
give a damn.

[my original point, not fully stated, is that mlock()/munlock()
  semantics are well-defined, and mlockall's aren't -- the POSIX
  statement leaves a lot of wiggle room for implementation
  dependencies]




More information about the questions mailing list