public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Meduna <stano@meduna.org>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: "linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>
Subject: Re: Realtime capable userspace?
Date: Sun, 14 Apr 2013 14:20:39 +0200	[thread overview]
Message-ID: <516A9F17.4080008@meduna.org> (raw)
In-Reply-To: <516A993D.9090006@xenomai.org>

On 14.04.2013 13:55, Gilles Chanteperdrix wrote:

> When malloc needs to grow the memory pool it manages, it will request
> memory to the kernel, using brk or mmap. Since in the Linux kernel, the
> memory is shared with the filesystem cache, the worst case latency for
> satisfying such a memory request is the time of a disk flush, so, given
> the latencies of good old hard disks, it is well in the milliseconds
> range. mlockall will simply force the kernel to satisfy the whole
> request ASAP instead of allocating it little by little, upon memory
> faults, so, may in fact increase the latency of the malloc service.

Yes, the theoretical possibility is definitely here, but I don't think
it can happen in the real life in our environment. Given the processes
running there there is nearly no way that the kernel does not have
enough non-dirty pages to satisfy a brk or mmap request. It is also
highly improbable that the brk/mmap are necessary - during the phase
where the deadlines matter the only way they can happen is heap
fragmentation causing something to temporarily overrun the brk limit.

You are right, as soon as the kernel has to flush some dirty pages
the malloc latency goes through the roof - we have a CF Card instead
of a good old hard disk, but tens of ms are definitely possible.

I am using the mlockall() mainly as a guard against throwing
non-dirty code and data pages out and then getting a major
pagefault and wait for the kernel to read them back. This is
a much more probable scenario.

Regards
-- 
                                           Stano


      reply	other threads:[~2013-04-14 12:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-14  9:01 Realtime capable userspace? Stanislav Meduna
2013-04-14 10:08 ` Gilles Chanteperdrix
2013-04-14 11:46   ` Stanislav Meduna
2013-04-14 11:55     ` Gilles Chanteperdrix
2013-04-14 12:20       ` Stanislav Meduna [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=516A9F17.4080008@meduna.org \
    --to=stano@meduna.org \
    --cc=gilles.chanteperdrix@xenomai.org \
    --cc=linux-rt-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox