From: Andreas Glatz <andreasglatz@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>,
Andreas Glatz <AndreasGlatz@domain.hid>,
Jan Kiszka <jan.kiszka@domain.hid>
Subject: Re: [Xenomai-help] New scheduler class
Date: Fri, 16 Apr 2010 11:29:42 -0400 [thread overview]
Message-ID: <20100416152942.GJ26116@domain.hid> (raw)
In-Reply-To: <4BC7118E.2050200@domain.hid>
On Thu, Apr 15, 2010 at 09:15:58AM -0400, Gilles Chanteperdrix wrote:
> Andreas Glatz wrote:
> > On Thu, Apr 15, 2010 at 08:40:00AM -0400, Gilles Chanteperdrix wrote:
> >> Andreas Glatz wrote:
> >>> Hi,
> >>>
> >>> On Thu, Apr 15, 2010 at 06:46:58AM -0400, Philippe Gerum wrote:
> >>>> On Wed, 2010-04-14 at 20:19 -0400, Andreas Glatz wrote:
> >>>>
> >>>>> One thing I've noticed though, and this is not related to the patch (I verified it on a
> >>>>> vanilla Xenomai system): Consider the example I included. It prints average cycle times
> >>>>> and the cycle time variance of the high priority task ("T2"). I noticed a big difference
> >>>>> in the cycle time variance when switching the first task ("T1") to secondary mode with
> >>>>> rt_task_set_mode() and setting the scheduler policy to either SCHED_FIFO, SCHED_IDLE or
> >>>>> SCHED_NORMAL. I'm assuming someone asked this before and I didn't pay attention :)
> >>>>> Can someone give me a short explanation or point me somewhere to get an explanation for
> >>>>> this behaviour? I didn't expect such a difference in variance:
> >>>>>
> >>>> Moving back to secondary mode is nothing more than triggering the
> >>>> rescheduling procedure linux-wise, so the time credit for
> >>>> SCHED_OTHER/IDLE tasks decay as usual during your work loop, preemption
> >>>> by high priority task is more likely and so on. This variance is just
> >>>> the sign that those tasks cannot ask for more than what their scheduling
> >>>> policy grants.
> >>>>
> >>> I think, I didn't express myself clearly enough. I was more puzzled about
> >>> the variance of the pure RT task (task w/o any secondary mode switches).
> >>> So it seems that changing the scheduling policy of the "relaxed" task has
> >>> an influence on the variance of the pure RT task. So the RT task seems
> >>> to wait for the "relaxed" task. But where exacly does it wait for it? Mmmmm...
> >> When waiting for the mutex?
> >>
> >
> > Ok. Maybe it's as ovvious as that. But I'm not quite there yet. Let me explain:
> > I know that the "relaxed" task ("T1") is in primary mode between rt_mutex_aquire()
> > and rt_mutex_release(). In other words when the pure RT task ("T2") starts waiting
> > on the mutex, "T1" should be primary mode and not be affected by the Linux
> > scheduling policy. After "T1" releases the mutex it switches back to secondary mode.
> > So I would expect the variance to be constant.
>
> Right. Maybe the problem is that the first call made by a thread to
> rt_printf causes a switch to secondary mode (auto mode, means that the
> first call to rt_printf calls malloc). You can confirm that by arming
> the T_WARNSW bit.
>
Ok. You where right, too. The reason for the high variance (compared to the case
where both tasks always run in primary mode) comes from the fact that the pure
RT task ("T2") starts blocking on rt_mutex_aquire() which in term boosts the
priority of the "relaxed" task ("T1") running in primary mode (since it is between
rt_mutex_aquire/rt_mutex_release).
At a first glance this made no sense to me since I thought that there shouldn't
be any difference between the case where both tasks always run in primary mode
and the case where "T1" switches to secondary mode only outside of
rt_mutex_aquire/rt_mutex_release.
Now I found the reason: If I pass the flag T_PRIOFF to "T1" (the task which
occasionally switches to secondary mode) I get the same variances for both cases
which I described in the previous paragraph. So the reason is clear: T2 not only
boosts the RT priority but also the Linux priority. Apparently, boosting the
Linux priority takes much longer and depends on the scheduling policy.
Is this a desired behaviour?
Andreas
next prev parent reply other threads:[~2010-04-16 15:29 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-01 23:08 [Xenomai-help] New scheduler class Andreas Glatz
2010-04-02 0:08 ` Jan Kiszka
2010-04-02 0:11 ` Gilles Chanteperdrix
2010-04-02 7:58 ` Henri Roosen
2010-04-02 8:06 ` Gilles Chanteperdrix
2010-04-02 8:27 ` Gilles Chanteperdrix
2010-04-02 9:18 ` Jan Kiszka
2010-04-02 9:24 ` Jan Kiszka
2010-04-02 9:27 ` Gilles Chanteperdrix
2010-04-02 9:32 ` Henri Roosen
2010-04-02 9:34 ` Gilles Chanteperdrix
2010-04-02 9:43 ` Henri Roosen
2010-04-02 10:07 ` Jan Kiszka
2010-04-04 23:04 ` Andreas Glatz
2010-04-06 6:45 ` Jan Kiszka
2010-04-15 0:19 ` Andreas Glatz
2010-04-15 9:02 ` Philippe Gerum
2010-04-20 14:12 ` Andreas Glatz
2010-04-23 10:54 ` Philippe Gerum
2010-09-30 12:52 ` Henri Roosen
2010-09-30 13:29 ` Gilles Chanteperdrix
2010-10-04 11:02 ` Philippe Gerum
2010-10-04 13:14 ` Henri Roosen
2010-10-10 21:17 ` Philippe Gerum
2010-04-15 10:46 ` Philippe Gerum
2010-04-15 12:36 ` Andreas Glatz
2010-04-15 12:40 ` Gilles Chanteperdrix
2010-04-15 12:59 ` Andreas Glatz
2010-04-15 13:15 ` Gilles Chanteperdrix
2010-04-16 15:29 ` Andreas Glatz [this message]
2010-04-16 15:57 ` Gilles Chanteperdrix
2010-04-02 10:00 ` Jan Kiszka
2010-04-02 10:02 ` Gilles Chanteperdrix
2010-04-02 8:26 ` Jan Kiszka
2010-04-02 8:29 ` Gilles Chanteperdrix
2010-04-02 8:58 ` Jan Kiszka
2010-04-02 9:03 ` Jan Kiszka
2010-04-02 9:24 ` Gilles Chanteperdrix
2010-04-02 10:02 ` Jan Kiszka
2010-04-02 10:05 ` Gilles Chanteperdrix
2010-04-02 10:12 ` Jan Kiszka
[not found] <mailman.6356.1286778008.12503.xenomai@xenomai.org>
2010-10-11 9:31 ` Andreas Glatz
2010-10-11 15:35 ` Henri Roosen
2010-10-12 7:16 ` Henri Roosen
2011-03-28 10:56 ` Henri Roosen
2011-03-28 11:44 ` Philippe Gerum
2011-05-01 15:01 ` Philippe Gerum
2011-05-02 8:58 ` Henri Roosen
2011-05-05 13:55 ` Philippe Gerum
2011-05-05 14:40 ` Henri Roosen
2011-06-28 9:26 ` Henri Roosen
2011-06-28 9:33 ` Philippe Gerum
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=20100416152942.GJ26116@domain.hid \
--to=andreasglatz@domain.hid \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=jan.kiszka@domain.hid \
--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.