All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: Tim Bird <tim.bird@am.sony.com>, Andrew Morton <akpm@osdl.org>,
	tglx@linutronix.de, george@mvista.com,
	linux-kernel@vger.kernel.org, johnstul@us.ibm.com,
	paulmck@us.ibm.com, hch@infradead.org, oleg@tv-sign.ru
Subject: Re: [PATCH]  ktimers subsystem 2.6.14-rc2-kt5
Date: Tue, 18 Oct 2005 10:46:55 +0200	[thread overview]
Message-ID: <20051018084655.GA28933@elte.hu> (raw)
In-Reply-To: <Pine.LNX.4.61.0510172227010.1386@scrub.home>


* Roman Zippel <zippel@linux-m68k.org> wrote:

> On Mon, 17 Oct 2005, Ingo Molnar wrote:
> 
> > why you insist on ktimers being 'process timers'?
> 
> Because they are optimized for process usage. OTOH kernel usage is 
> more than just "timeouts".

you have cut out the rest of what i write in the paragraph, which IMO 
answers your question:

> > They are totally separate entities, not limited to any process 
> > notion. One of their first practical use happens to be POSIX process 
> > timers (both itimers and ptimers) via them, but no way are ktimers 
> > only 'process timers'. They are very generic timers, usable for any
> > kernel purpose.

so i can only repeat that ktimers is a generic timer subsystem, with a 
focus on _actually delivering a timer event_.

and no, ktimers are not "optimized for process usage" (or tied to 
whatever other process notion, as i said before), they are optimized 
for:

 - the delivery of time related events

as contrasted to the timeout-API (a'ka "timer wheel") code in 
kernel/timers.c that is optimized towards:

 - the fast adding/removal of timers

without too much focus on robust and deterministic delivery of events.

these two concepts are conflicting, and i claim that a (sane) data 
structure that maximally fulfills both sets of requirements does not 
exist, mathematically. (to repeat, the requirements are: 'fast 
add/remove' and 'fast+deterministic expiry')

at this point i'd really suggest for readers to lean back and think 
about the mathematical foundations of timer data structures for a bit, 
with a focus on the tradeoffs that the timer wheel data structure has, 
vs. the tradeoffs of the rbtree data structure that ktimers has.

My claim is that if you _know_ that a timer will expire most likely, you 
want it to order at insertion time - i.e. you want to have a tree 
structure. If you _know_ that a timer will most likely _not_ expire, 
then you can avoid the tree overhead by 'delaying' the decision of 
sorting timers, to the point in the future where we really are forced to 
do so.

The result of this mathematical paradox is that we end up with two data 
structures: one is the timer wheel (kernel/timers.c) for 
timeout/exception related use; the other one is ktimers 
(kernel/ktimers.c), for expiry oriented use.

> > so to answer your question: it is totally possible for a watchdog 
> > mechanism to use ktimers. In fact it would be desirable from a 
> > robustness POV too: 
> 
> "possible" and "desirable" is still different from "preferable", as 
> they involve a higher cost.

[ in my answer above you are free to substitute "preferable" with
  "desirable" - i do mean it as it reads in plain English. ]

> > e.g. we dont want a watchdog from being 
> > overload-able via too many timeouts in the timer wheel ...
> 
> Please explain.

e.g. on busy networked servers (i.e. ones that do have a need for 
watchdogs) the timer wheel often includes large numbers of timeouts, 
99.9% of which never expire. If they do expire en masse for whatever 
reason, then we can get into overload mode: a million timers might have 
to expire before we get to process the watchdog event and act upon it.  
This can delay the watchdog event significantly, which delay might (or 
might not) matter to the watchdog application.

in short: the timer wheel was not designed with determinism in mind (nor 
should 'simple timeouts' care about determinism). Watchdogs are 
preferably (and desirably) implemented via the most deterministic timer 
mechanism that the kernel offers: ktimers in this particular case.

	Ingo

  reply	other threads:[~2005-10-18  8:46 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-28 20:43 [PATCH] ktimers subsystem 2.6.14-rc2-kt5 tglx
2005-09-28 23:59 ` Frank Sorenson
2005-09-29  0:50   ` Frank Sorenson
2005-09-29  0:56     ` john stultz
2005-09-29  1:05       ` Frank Sorenson
2005-09-29  1:10 ` john stultz
2005-09-29  6:53   ` Thomas Gleixner
2005-09-30 15:58     ` Frank Sorenson
2005-09-29 19:57 ` George Anzinger
2005-10-01  1:03 ` Roman Zippel
2005-10-01 11:22   ` Ingo Molnar
2005-10-04  1:59     ` George Anzinger
2005-10-04  5:51       ` Ingo Molnar
2005-10-10 12:42     ` Roman Zippel
2005-10-10 14:04       ` Ingo Molnar
2005-10-01 12:05   ` Thomas Gleixner
2005-10-10 17:22     ` Roman Zippel
2005-10-11  7:42       ` Thomas Gleixner
2005-10-12 22:36         ` Roman Zippel
2005-10-12 23:46           ` George Anzinger
2005-10-16 16:34             ` Roman Zippel
2005-10-16 19:26               ` Thomas Gleixner
2005-10-16 23:03                 ` Roman Zippel
2005-10-17  7:59                   ` Ingo Molnar
2005-10-17  8:26                     ` Steven Rostedt
2005-10-17  9:29                     ` Roman Zippel
2005-10-17  9:41                       ` Ingo Molnar
2005-10-17  9:56                         ` Andrew Morton
2005-10-17 11:00                           ` Ingo Molnar
2005-10-17 16:25                           ` Roman Zippel
2005-10-17 16:49                             ` Tim Bird
2005-10-17 17:26                               ` Steven Rostedt
2005-10-17 18:49                               ` Roman Zippel
2005-10-17 19:19                                 ` Tim Bird
2005-10-17 19:48                                   ` Roman Zippel
2005-10-17 20:13                                     ` Ingo Molnar
2005-10-17 20:31                                       ` Roman Zippel
2005-10-18  8:46                                         ` Ingo Molnar [this message]
2005-10-18 23:52                                           ` Tim Bird
2005-10-19  0:03                                             ` George Anzinger
2005-10-19  1:58                                           ` Roman Zippel
2005-10-19  6:46                                             ` Ingo Molnar
2005-10-19 10:49                                             ` kernel/timer.c design (was: Re: ktimers subsystem) Ingo Molnar
2005-10-19 17:48                                               ` kernel/timer.c design Tim Bird
2005-10-19 18:00                                               ` Tim Bird
2005-10-19 19:04                                                 ` Thomas Gleixner
2005-10-19 22:12                                               ` kernel/timer.c design (was: Re: ktimers subsystem) Roman Zippel
2005-10-19 11:40                                             ` [PATCH] ktimers subsystem 2.6.14-rc2-kt5 Ingo Molnar
2005-10-19 11:58                                             ` Ingo Molnar
2005-10-19 22:24                                               ` Roman Zippel
2005-10-17 20:09                                 ` Ingo Molnar
2005-10-17 20:55                             ` Thomas Gleixner
2005-10-18  0:07                               ` Roman Zippel
2005-10-18  1:03                                 ` George Anzinger
2005-10-19  1:26                                   ` Roman Zippel
2005-10-19  2:52                                     ` George Anzinger
2005-10-21 16:22                                       ` Roman Zippel
2005-10-23 18:17                                         ` George Anzinger
2005-10-27 20:23                                           ` Roman Zippel
2005-10-28  4:52                                             ` Steven Rostedt
2005-10-28 16:06                                               ` Roman Zippel
2005-10-17 16:33                         ` Roman Zippel
2005-10-17 16:39                           ` Ingo Molnar
2005-10-17 16:54                             ` Roman Zippel
2005-10-17 17:35                               ` Ingo Molnar
2005-10-17  9:54                       ` Steven Rostedt
2005-10-04  1:55   ` George Anzinger
  -- strict thread matches above, loose matches on Subject: below --
2005-10-17 18:38 linux
2005-10-17 19:04 ` Roman Zippel
2005-10-17 22:41   ` linux

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=20051018084655.GA28933@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --cc=george@mvista.com \
    --cc=hch@infradead.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@tv-sign.ru \
    --cc=paulmck@us.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=tim.bird@am.sony.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 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.