All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Williams <pwil3058@bigpond.net.au>
To: Esben Nielsen <nielsen.esben@googlemail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Con Kolivas <kernel@kolivas.org>, Nick Piggin <npiggin@suse.de>,
	Mike Galbraith <efault@gmx.de>,
	Arjan van de Ven <arjan@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	caglar@pardus.org.tr, Willy Tarreau <w@1wt.eu>,
	Gene Heskett <gene.heskett@gmail.com>, Mark Lord <lkml@rtr.ca>,
	Zach Carter <linux@zachcarter.com>,
	buddabrod <buddabrod@gmail.com>
Subject: Re: [patch] CFS scheduler, -v8
Date: Tue, 08 May 2007 10:35:36 +1000	[thread overview]
Message-ID: <463FC5D8.2090502@bigpond.net.au> (raw)
In-Reply-To: <Pine.LNX.4.64.0705071311040.14011@frodo.shire>

Esben Nielsen wrote:
> 
> 
> On Sun, 6 May 2007, Linus Torvalds wrote:
> 
>>
>>
>> On Sun, 6 May 2007, Ingo Molnar wrote:
>>>
>>> * Linus Torvalds <torvalds@linux-foundation.org> wrote:
>>>
>>>> So the _only_ valid way to handle timers is to
>>>>  - either not allow wrapping at all (in which case "unsigned" is 
>>>> better,
>>>>    since it is bigger)
>>>>  - or use wrapping explicitly, and use unsigned arithmetic (which is
>>>>    well-defined in C) and do something like "(long)(a-b) > 0".
>>>
>>> hm, there is a corner-case in CFS where a fix like this is necessary.
>>>
>>> CFS uses 64-bit values for almost everything, and the majority of values
>>> are of 'relative' nature with no danger of overflow. (They are signed
>>> because they are relative values that center around zero and can be
>>> negative or positive.)
>>
>> Well, I'd like to just worry about that for a while.
>>
>> You say there is "no danger of overflow", and I mostly agree that once
>> we're talking about 64-bit values, the overflow issue simply doesn't
>> exist, and furthermore the difference between 63 and 64 bits is not 
>> really
>> relevant, so there's no major reason to actively avoid signed entries.
>>
>> So in that sense, it all sounds perfectly sane. And I'm definitely not
>> sure your "292 years after bootup" worry is really worth even 
>> considering.
>>
> 
> I would hate to tell mission control for Mankind's first mission to another
> star to reboot every 200 years because "there is no need to worry about 
> it."
> 
> As a matter of principle an OS should never need a reboot (with 
> exception for upgrading). If you say you have to reboot every 200 years, 
> why not every 100? Every 50? .... Every 45 days (you know what I am 
> referring to :-) ?

There's always going to be an upper limit on the representation of time. 
  At least until we figure out how to implement infinity properly.

> 
>> When we're really so well off that we expect the hardware and software
>> stack to be stable over a hundred years, I'd start to think about issues
>> like that, in the meantime, to me worrying about those kinds of issues
>> just means that you're worrying about the wrong things.
>>
>> BUT.
>>
>> There's a fundamental reason relative timestamps are difficult and almost
>> always have overflow issues: the "long long in the future" case as an
>> approximation of "infinite timeout" is almost always relevant.
>>
>> So rather than worry about the system staying up 292 years, I'd worry
>> about whether people pass in big numbers (like some MAX_S64 
>> approximation)
>> as an approximation for "infinite", and once you have things like that,
>> the "64 bits never overflows" argument is totally bogus.
>>
>> There's a damn good reason for using only *absolute* time. The whole
>> "signed values of relative time" may _sound_ good, but it really sucks in
>> subtle and horrible ways!
>>
> 
> I think you are wrong here. The only place you need absolute time is a 
> for the clock (CLOCK_REALTIME). You waste CPU using a 64 bit
> representation when you could have used a 32 bit. With a 32 bit 
> implementation you are forced to handle the corner cases with wrap 
> around and too big arguments up front. With a 64 bit you hide those 
> problems.

As does the other method.  A 32 bit signed offset with a 32 bit base is 
just a crude version of 64 bit absolute time.

> 
> I think CFS would be best off using a 32 bit timer counting in micro 
> seconds. That would wrap around in 72 minuttes. But as the timers are 
> relative you will never be able to specify a timer larger than 36 
> minuttes in the future. But 36 minuttes is redicolously long for a 
> scheduler and a simple test limiting time values to that value would not 
> break anything.

Except if you're measuring sleep times.  I think that you'll find lots 
of tasks sleep for more than 72 minutes.

Peter
-- 
Peter Williams                                   pwil3058@bigpond.net.au

"Learning, n. The kind of ignorance distinguishing the studious."
  -- Ambrose Bierce

  parent reply	other threads:[~2007-05-08  0:35 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-01 21:22 [patch] CFS scheduler, -v8 Ingo Molnar
2007-05-02  2:57 ` Ting Yang
2007-05-02  5:10   ` Willy Tarreau
2007-05-02  5:30   ` William Lee Irwin III
2007-05-02 10:05   ` Bill Huey
2007-05-02 10:27   ` Ingo Molnar
2007-05-02 17:36   ` Srivatsa Vaddagiri
2007-05-02 17:48     ` William Lee Irwin III
2007-05-02 18:15       ` Ingo Molnar
2007-05-02 18:56         ` William Lee Irwin III
2007-05-02 19:12           ` Ingo Molnar
2007-05-02 19:42             ` William Lee Irwin III
2007-05-03  2:48       ` Ting Yang
2007-05-03  3:18       ` Ting Yang
2007-05-03 10:19         ` Bill Huey
2007-05-02 23:41     ` Ting Yang
2007-05-02 18:42   ` Li, Tong N
2007-05-02 19:10     ` William Lee Irwin III
2007-05-03  3:07     ` Ting Yang
2007-05-03  8:50   ` Ingo Molnar
2007-05-03 14:26     ` Srivatsa Vaddagiri
2007-05-03 15:19       ` Ting Yang
2007-05-03 15:02     ` Ting Yang
2007-05-02  6:37 ` Mike Galbraith
2007-05-02  6:45   ` Ingo Molnar
2007-05-02  8:03   ` Gene Heskett
2007-05-02  8:12     ` Mike Galbraith
2007-05-02  8:48       ` Gene Heskett
2007-05-02  8:13     ` Ingo Molnar
2007-05-02  8:51       ` Gene Heskett
2007-05-02  7:59 ` Mike Galbraith
2007-05-02  8:11   ` Gene Heskett
2007-05-02 10:40   ` Ingo Molnar
2007-05-02  9:08 ` Balbir Singh
2007-05-02 10:05   ` Ingo Molnar
2007-05-02 10:59     ` Balbir Singh
2007-05-02 11:17       ` Ingo Molnar
2007-05-05  8:31         ` Esben Nielsen
2007-05-05 17:44           ` Linus Torvalds
2007-05-06  8:29             ` Ingo Molnar
2007-05-06  8:36               ` Willy Tarreau
2007-05-06  8:52                 ` Ingo Molnar
2007-05-06 17:45               ` Linus Torvalds
2007-05-07 11:30                 ` Esben Nielsen
2007-05-07 15:55                   ` Ingo Molnar
2007-05-07 16:11                   ` Linus Torvalds
2007-05-08  0:35                   ` Peter Williams [this message]
2007-05-08  9:05                     ` Esben Nielsen
2007-05-09  0:01                       ` Peter Williams
2007-05-10 13:09                     ` Pavel Machek
2007-05-11 16:50                       ` Linus Torvalds
2007-05-11 19:18                         ` Pavel Machek
2007-05-11 19:37                           ` Willy Tarreau
2007-05-11 20:53                             ` Kevin Bowling
2007-05-07 11:09             ` Esben Nielsen
2007-05-07 16:28               ` Linus Torvalds
2007-05-07 18:39                 ` Johannes Stezenbach
2007-05-07 18:55                   ` Linus Torvalds
2007-05-08  7:34                   ` Esben Nielsen
2007-05-08  9:54                     ` Johannes Stezenbach
2007-05-08 10:27                       ` Esben Nielsen
2007-05-08  5:36                 ` Matt Mackall
2007-05-02 12:58 ` Mark Lord
2007-05-02 12:58 ` Vegard Nossum
2007-05-02 16:41   ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2007-05-03  8:20 Zoltan Boszormenyi
2007-05-03 13:02 ` Ingo Molnar
2007-05-03 13:29   ` Damien Wyart
2007-05-03 14:53     ` Srivatsa Vaddagiri
2007-05-03 15:53       ` William Lee Irwin III
2007-05-03 18:44         ` Li, Tong N
2007-05-03 19:52           ` William Lee Irwin III
2007-05-07 14:22         ` Srivatsa Vaddagiri
2007-05-07 20:54           ` Li, Tong N
2007-05-07  0:04     ` Bill Davidsen

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=463FC5D8.2090502@bigpond.net.au \
    --to=pwil3058@bigpond.net.au \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=buddabrod@gmail.com \
    --cc=caglar@pardus.org.tr \
    --cc=efault@gmx.de \
    --cc=gene.heskett@gmail.com \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@zachcarter.com \
    --cc=lkml@rtr.ca \
    --cc=mingo@elte.hu \
    --cc=nielsen.esben@googlemail.com \
    --cc=npiggin@suse.de \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=w@1wt.eu \
    /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.