All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: 书呆子 <zhoupeng1982@qq.com>
Cc: xenomai <xenomai@xenomai.org>
Subject: Re: [Xenomai] I find a way to reduce latency, but I don't know why.
Date: Wed, 18 Mar 2015 08:51:22 +0100	[thread overview]
Message-ID: <20150318075122.GL16113@hermes.click-hack.org> (raw)
In-Reply-To: <tencent_07B7EF291D718FAF2A4D5BBC@qq.com>

On Tue, Mar 17, 2015 at 09:41:05PM +0800, 书呆子 wrote:
> The x86 machine have two CPUs, and I need periodic task on CPU1.
> In order to reduce latency, a busy task will run on CPU2.
> 
> cpu1_task
> {
>   rt_task_wait_period;
>   real_work;
>   rt_sem_v(&busySEM);
> }
> 
> cpu2_task
> {
>   rt_sem_p(&busySEM);
>   rt_timer_spin(spin_ns);
> }
> 
> And spin_ns will be long enough: spin_ns + real_work_ns > periodic cycle.
> Yes, it means rt_code is always running on CPU1 or CPU2.
> 
> In doing this, the cpu1_task will get low latency and drift, but why ?

Two possibilities:
- task2 is cache friendly, so if the cache is shared between the two
cpus, it prevents Linux from evicting xenomai and I-pipe code from
the cache, we know that cache has a big influence on latency;
- task2 prevents the cpu from entering idle mode, and so potentially
prevents any low power optimization from happening, low power modes
are generally not latency friendly.

Note however that measurements on an idle system do not really
matter much for finding the worst case latency. Real measurements
should last for hours and with the machine put under load. I bet
with measurements done this way, the differences you observe with
the tests you do would be negligible compared to the worst case
latency. And if there is a real difference, then the I-pipe tracer
would help you find from where it comes.

-- 
					    Gilles.


  reply	other threads:[~2015-03-18  7:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 13:41 [Xenomai] I find a way to reduce latency, but I don't know why =?gb18030?B?yum09NfT?=
2015-03-18  7:51 ` Gilles Chanteperdrix [this message]
     [not found]   ` <tencent_1DF1E8A94FD8F46B59E71CC9@qq.com>
2015-03-18 13:39     ` Gilles Chanteperdrix
2015-03-23  2:44       ` Zhoupeng
  -- strict thread matches above, loose matches on Subject: below --
2015-03-18 13:36 =?gb18030?B?WmhvdXBlbmc=?=

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=20150318075122.GL16113@hermes.click-hack.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=xenomai@xenomai.org \
    --cc=zhoupeng1982@qq.com \
    /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.