All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Jan Glauber <jan.glauber@de.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [patch 0/2] s390 related scheduler patches and questions
Date: Thu, 23 Aug 2007 22:05:26 +0200	[thread overview]
Message-ID: <20070823200526.GA8486@elte.hu> (raw)
In-Reply-To: <200708232126.36475.borntraeger@de.ibm.com>


* Christian Borntraeger <borntraeger@de.ibm.com> wrote:

> Another question:
> 
> nanosecond resolution seems not ideal for 64bit values, at least if an 
> architecture has to do calculations. For example our cpu timer is 
> signed 64bit and bit 51 (63=LSB) steps by one each microsecond. To 
> create a nanosecond based timer we need: nsecs= clock*125/512 or nsecs 
> = clock/512*125. The first variant overflows in a time frame that is 
> still reasonable to be seen in practice (about 2 years if I made no 
> errors), the second variant introduces a stepping rate of 125ns. Of 
> course we could use nsec = (((((((clock/8)*5)/4)*5)/4)*5)/4), to have 
> a long overflow period and a 1.25ns stepping rate but this looks quite 
> ugly. Are you going to stick with nanosecond resolution? If yes, do 
> you think a stepping rate of 125ns is ok? Any chance to change the 
> scheduler resolution to microseconds? ;-)

there are noticeable accounting artifacts on fast boxes that do 
sub-microsecond scheduling, so getting the best sched_clock() resolution 
is certainly handy. (Also, nanoseconds gives us some rounding-error 
room.) But 0.125 usecs should still be fine.

the 2 years overflow is not an issue: you could solve that by only using 
the first 55 bits of the clock. This means the clock would wrap around 
every 1.14 years - the effects of that are that the "dont let time go 
backwards" code in the scheduler will ignore a very small interval 
(which happens at the wraparound) and will continue with the 
wrapped-around clock from that point on. The rq->clock itself is a true, 
monotonic 64-bit clock that wraps every 584.9 years.

[ and even after 584.9 years it should have no serious failure mode, as 
  the timestamps are used in a relative manner. The only, minimal effect 
  is on tasks that sleep for more than 584 years - which could get a few 
  millisecs less sleeper fairness share. I am not overly worried about
  getting bugreports about that in my lifetime though =B-) (unless
  someone gets serious about bio-cryogenics R&D, real soon.) ]

	Ingo

      parent reply	other threads:[~2007-08-23 20:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-23 19:26 [patch 0/2] s390 related scheduler patches and questions Christian Borntraeger
2007-08-23 19:28 ` [patch 1/2] virtual sched_clock() for s390 Christian Borntraeger
2007-08-23 19:29 ` [patch 2/2] Let process accouting trust sched_clock Christian Borntraeger
2007-08-23 20:05 ` Ingo Molnar [this message]

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=20070823200526.GA8486@elte.hu \
    --to=mingo@elte.hu \
    --cc=borntraeger@de.ibm.com \
    --cc=jan.glauber@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /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.