linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* kernel/timer.c
@ 2003-04-11 13:17 Wojciech Kromer
  2003-04-11 14:38 ` kernel/timer.c Joakim Tjernlund
  0 siblings, 1 reply; 8+ messages in thread
From: Wojciech Kromer @ 2003-04-11 13:17 UTC (permalink / raw)
  To: Linuxppc-Embedded (E-mail)


Anyone knows why tehere is a line:

expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec);

in kernel/timer.c sys_nanosleep
It adds additional time tick to expire. If anyone uses small HZ value
(eg 100 which is default for arch-ppc) this causes aditional 10ms delay
when calling nanosleep.


For me ( found by Andrzej Kass)
 it should be:

expire = timespec_to_jiffies(&t) + !(t.tv_sec || t.tv_nsec);
   //^^add extra tick if there is
  // nothing in tv_sec and nothing in tv_nsec


--
* * * * * * * * * * * *
* per pedes ad astra! *
* * * * * * * * * * * *    mailto:krom@dgt-lab.com.pl


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: kernel/timer.c
@ 2003-04-11 21:25 Darin.Johnson
  0 siblings, 0 replies; 8+ messages in thread
From: Darin.Johnson @ 2003-04-11 21:25 UTC (permalink / raw)
  To: linuxppc-embedded


> From: ext Joakim Tjernlund [mailto:joakim.tjernlund@lumentis.se]
> Sent: Friday, April 11, 2003 7:39 AM
>
> hmm, why not just:
>    expire = timespec_to_jiffies(&t);
> if tv_sec and tv_sec are zero, do you need to sleep at all?

Trying to sleep for 0 time periods is difficult in many timer systems,
and this is probably true for Linux also. Ie, time "t" has already
passed by the time this routine is executed, but time "t+1" has not.

The decision is whether to make the delay 1 in this case, or to just
schedule the next ready thread.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-04-12 12:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-11 13:17 kernel/timer.c Wojciech Kromer
2003-04-11 14:38 ` kernel/timer.c Joakim Tjernlund
2003-04-12  7:07   ` kernel/timer.c Wojciech Kromer
2003-04-12  8:29     ` kernel/timer.c Joakim Tjernlund
2003-04-12  9:32       ` kernel/timer.c Wojciech Kromer
2003-04-12 10:35         ` kernel/timer.c Joakim Tjernlund
2003-04-12 12:52           ` kernel/timer.c Joakim Tjernlund
  -- strict thread matches above, loose matches on Subject: below --
2003-04-11 21:25 kernel/timer.c Darin.Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).