All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Marco Guerri <gmarco.dev@gmail.com>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai] Kernel space task VS User space task latency
Date: Wed, 10 Apr 2013 21:58:27 +0200	[thread overview]
Message-ID: <5165C463.4090600@xenomai.org> (raw)
In-Reply-To: <5165C158.7060005@gmail.com>

On 04/10/2013 09:45 PM, Marco Guerri wrote:

> Hi everyone,
> 
> I was wondering if there is anyone who can help me clarify some very 
> basic doubts I have regarding Xenomai internals.
> I am working with Xenomai 2.6.2.1 on a 2.6.31 kernel on an i.MX35 
> processor (thus, ARM arch).
> 
> Using the latency test program, I get the following results for User 
> space and Kernel space tasks.
> 
> *** IDLE ***
> User space --> Mean: ~7us
> Kernel space --> Mean: ~4us
> 
> *** HEAVY LOAD (dohell) ***
> User space --> Mean: ~34us
> Kernel space --> Mean: ~18us
> 
> Could you give me some hints on how to explain this great difference, 
> expecially with the system under load?
> What are the factors that could worsen the latency in IDLE conditions?
> What are the factors that can explain a value of latency doubled in case 
> of a system under load?


These results are completely expected. The code executed between the
time an interrupt happens and a kernel thread is woken up is simply
shorter than the code executed between the time an interrupt happens and
a user-space thread is woken up. On a loaded system, the difference in
time is even greater due to cache effects.

The latency in idle conditions is meaningless. The average latency is
meaningless.

Now the choice between kernel-space and user-space:
- should not be an all-or-nothing choice, you can do some performance
critical things in kernel-space by writing a driver using the RTDM skin,
and have it communicate with user-space tasks which should remain the
master;
- should not be governed by latencies measurement only (especially not
measurement on an idle system and measurement of average values),
programming in kernel-space is hard, takes time, and some habit, it
better be worth it.

-- 
                                                                Gilles.


      reply	other threads:[~2013-04-10 19:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10 19:45 [Xenomai] Kernel space task VS User space task latency Marco Guerri
2013-04-10 19:58 ` Gilles Chanteperdrix [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=5165C463.4090600@xenomai.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=gmarco.dev@gmail.com \
    --cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.