Re: realtime-preempt and arm
From: tike64
Date: Thu Dec 14 2006 - 02:28:29 EST
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> Also, have you tried this with a nanosleep instead of a select.
> Select's timeout is just that, a timeout. It's not suppose to be
> accurate, as long as it doesn't expire early. The reason I state
> this, is that select uses a different mechanism than nanosleep, and
> that can indeed affect the jitter.
Ok, understood; I tried this:
t = raw_timer();
ts.tv_nsec = 5000000;
ts.tv_sec = 0;
nanosleep(&ts, 0);
t = raw_timer() - t;
It is better but I still see 8ms occasional delays when listing
nfs-mounted directories onto FB. And, what is funny, also this version
makes the average delay 20ms as if it made the jiffy 20ms.
> Although without the high res enabled, you can't get better than
jiffy
> resolution, you shouldn't get a large jitter either. BTW, using high
> res won't help the select anyway. The select uses a normal
> schedule_timeout, which means that it's not really expected to
> timeout, but something should wake it up before hand. Which means
that
> the good old timer wheel (non-hrtimer) is going to do the waking of
> the process. This means that you need to wait for the timer softirq
to
> be scheduled before your process wakes up. If there's a process with
a
> higher priority than the timer softirq running, then you need to
wait.
>
> Using nansleep uses the hrtimer code (available with out the high
> resolutions). The hrtimer uses its own timer softirq
> (softirq-hrtimer), and it is special. It inherits the priority of
the
> task that created the timer when the timer goes off. Also, something
> like nanosleep, won't even use the softirq, and will bypass the
> softirq all together, and wake your process up from the interrupt.
>
> So basically, don't use select for timing.
Thanks a lot for a thorough explanation. While we are at it, is it then
the only option to use threads to wait for IO and use ms-accurate
timing? Formerly I have used select with timeouts for this task but
timing requirement have not been this accurate back then, of course.
--
tike
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
____________________________________________________________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/