mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: Christopher Friesen <cfriesen@nortel.com>,
	linux-kernel@vger.kernel.org, mingo@elte.hu, akpm@osdl.org,
	george@mvista.com, johnstul@us.ibm.com, paulmck@us.ibm.com
Subject: Re: [ANNOUNCE] ktimers subsystem
Date: Fri, 23 Sep 2005 08:49:57 +0200	[thread overview]
Message-ID: <1127458197.24044.726.camel@tglx.tec.linutronix.de> (raw)
In-Reply-To: <Pine.LNX.4.61.0509230151080.3743@scrub.home>

On Fri, 2005-09-23 at 02:25 +0200, Roman Zippel wrote:
> > Maybe it would make sense to have the API be in nanoseconds and internally use
> > 32bit ms for now, and only change to 64bit nanos when we actually move to
> > sub-ms resolution timers.
> 
> Actually the decision to use ns has nothing to do with API issues. 
> <linux/jiffies.h> has already a lot of options to specify timeouts for 
> kernel timer. The official userspace API is mostly timespec/timeval.
> The nsec_t type is an _internal_ type to manage time, so this makes it 
> possible to do something like this:
> 
> #ifdef CONFIG_HIRES_TIMER
> typedef u64 ktime_t;
> #else
> typedef u32 ktime_t;
> #endif

Sure that's possible, but the 32bit storage format has its limitiations
and it is not possible to keep the code compatible for both use cases.

Posix timers - both CLOCK_REALTIME and CLOCK_MONOTONIC - can be
programmed in absolute time. In a 32bit representation with ms
resolution we can store ~49 days, so we can not fit the value which come
up from user space wihtout correction/conversion except we limit the use
cases to 49 days uptime and clock realtime < 49days since the epoch.

If we can not fit the given value into the internal representation, we
have to do exactly what the current implementation of clock realtime in
posix-timers.c has to do. Storing information about xtime / monotonic
offset, adding the timer to yet another list (abs_list) convert to
jiffies and in case the clock gets set, run through all the affected
timers in abs_list recalculate the expiry value and requeue them.

The idea of ktimers is to use the requested time given by a timespec in
human time without any corrections, so we actually can avoid the above.

Also doing time ordered insertion into a list introduces incompabilities
between 32/64 bit storage formats.

I carefully waged the necessary quirk load vs. the cleanliness,
simplicity and robustness of a pure 64 bit implementation. The resulting
payload for 32bit systems, which is in the range of 1-3 instructions per
fast path operation (add, sub, compare) is not worth the trouble IMO to
give up a clean, simple and robust design, which also allows high
resolution timers with no big change to the base implementation.


tglx



  reply	other threads:[~2005-09-23  6:49 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-19 16:48 tglx
2005-09-19 16:48 ` [PATCH] " tglx
2005-09-19 21:47 ` [ANNOUNCE] " Thomas Gleixner
2005-09-19 22:03 ` Christoph Lameter
2005-09-19 22:17   ` Thomas Gleixner
2005-09-19 22:24     ` Christoph Lameter
2005-09-19 22:44       ` Thomas Gleixner
2005-09-19 22:50         ` john stultz
2005-09-19 22:58           ` Thomas Gleixner
2005-09-19 23:04         ` Christoph Lameter
2005-09-19 23:12           ` Thomas Gleixner
2005-09-20  7:14             ` Ingo Molnar
2005-09-20  7:10       ` Ingo Molnar
2005-09-21 19:24       ` Pavel Machek
2005-09-19 22:39     ` Christopher Friesen
2005-09-19 22:54       ` Thomas Gleixner
2005-09-20  4:57         ` Christopher Friesen
2005-09-20  5:11           ` Thomas Gleixner
2005-09-20  0:43   ` George Anzinger
2005-09-21 19:50 ` Roman Zippel
2005-09-21 22:41   ` Thomas Gleixner
2005-09-22 12:59     ` Ingo Molnar
2005-09-22 23:09     ` Roman Zippel
2005-09-22 23:31       ` Christopher Friesen
2005-09-23  0:25         ` Roman Zippel
2005-09-23  6:49           ` Thomas Gleixner [this message]
2005-09-24  3:15             ` Roman Zippel
2005-09-24  5:16               ` Ingo Molnar
2005-09-24 10:35                 ` Roman Zippel
2005-09-24 13:56                   ` Thomas Gleixner
2005-09-24 16:51                     ` Daniel Walker
2005-09-24 23:45                     ` Roman Zippel
2005-09-25 21:00                       ` Thomas Gleixner
2005-09-27 16:54                         ` Roman Zippel
2005-09-27 19:03                           ` Tim Bird
2005-09-28 16:36                             ` Roman Zippel
2005-09-25 21:02                       ` Thomas Gleixner
2005-09-27 16:48                         ` Roman Zippel
2005-09-27 18:38                           ` Tim Bird
2005-09-27 20:36                             ` George Anzinger
2005-09-23  2:25       ` john stultz
2005-09-23  8:27       ` Thomas Gleixner
2005-09-24  2:43         ` Roman Zippel
2005-09-24  5:03           ` Ingo Molnar
2005-09-24  9:04           ` James Bruce
2005-09-23 15:21       ` Paul E. McKenney
2005-09-24  3:38         ` Roman Zippel
2005-09-25 15:48 Sid Boyce
2005-09-25 18:20 ` Zwane Mwaikambo
2005-09-26  0:02   ` Sid Boyce

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=1127458197.24044.726.camel@tglx.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=akpm@osdl.org \
    --cc=cfriesen@nortel.com \
    --cc=george@mvista.com \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulmck@us.ibm.com \
    --cc=zippel@linux-m68k.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®