All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ian Kent <raven@themaw.net>, Chuck Ebbert <cebbert@redhat.com>,
	Bill Davidsen <davidsen@tmr.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [patch] CFS scheduler, -v19
Date: Thu, 19 Jul 2007 10:16:50 +0200	[thread overview]
Message-ID: <20070719081650.GA14299@elte.hu> (raw)
In-Reply-To: <alpine.LFD.0.999.0707180852540.27353@woody.linux-foundation.org>


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> > ah! It passes in a low-res time source into a high-res time 
> > interface (pthread_cond_timedwait()). Could you change the 
> > time(NULL) + 1 to time(NULL) + 2, or change it to:
> > 
> > 	gettimeofday(&wait, NULL);
> > 	wait.tv_sec++;
> 
> This is wrong. It's wrong for two reasons:
> 
>  - it really shouldn't be needed. I don't think "time()" has to be 
>    *exactly* in sync, but I don't think it can be off by a third of a 
>    second or whatever (as the "30% CPU load" would seem to imply)
> 
>  - gettimeofday works on a timeval, pthread_cond_timedwait() works on a 
>    timespec.

ah, i didnt notice that automount mixed up timespec with timeval! That 
is nasty and the tv_nsec field (which really is ts_usec to 
pthread_cond_timewait()) must stay cleared - or rather, to avoid bugs of 
this type, a timespec variable should be used for all this.

> So if it actually makes a difference, it makes a difference for the 
> *wrong* reason: the time is still totally nonsensical in the tv_nsec 
> field (because it actually got filled in with msecs!), but now the 
> tv_sec field is in sync, so it hides the bug.
> 
> Anyway, hopefully the patch below might help. But we probably should make 
> this whole thing a much more generic routine (ie we have our internal 
> "getnstimeofday()" that still is missing the second-overflow logic, and 
> that is quite possibly the one that triggers the "30% off" behaviour).

yeah, i'll generalize it, but our internal getnstimeofday() used on most 
architectures is using __get_realtime_clock_ns(), and the patch you 
attached already adds the second-overflow logic to it.

there are two versions of getnstimeofday(), a TIME_INTERPOLATION one and 
a !TIME_INTERPOLATION one. TIME_INTERPOLATION is only used on ia64 at 
the moment - and that one indeed does not have the second overflow 
logic.

> Ingo, I'd suggest:
>  - ger rid of "timespec_add_ns()", or at least make it return a return 
>    value for when it overflows.
>  - make all the people who overflow into tv_sec call a "fix_up_seconds()" 
>    thing that does the xtime overflow handling.

ok, i'll do something clean.

	Ingo

  parent reply	other threads:[~2007-07-19  9:27 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-06 17:33 [patch] CFS scheduler, -v19 Ingo Molnar
2007-07-08 17:46 ` Willy Tarreau
2007-07-09 22:39   ` Ingo Molnar
2007-07-17 21:44     ` Willy Tarreau
2007-07-10  8:08 ` Mike Galbraith
2007-07-11 17:26   ` Bill Davidsen
2007-07-11 20:55     ` Ingo Molnar
2007-07-12 12:41       ` Bill Davidsen
2007-07-13 21:19       ` Bill Davidsen
2007-07-16 21:34         ` Chuck Ebbert
2007-07-16 21:55           ` Ingo Molnar
2007-07-17  4:22             ` Bill Davidsen
2007-07-17  5:01             ` Ian Kent
2007-07-17  7:45               ` Ingo Molnar
2007-07-17 11:17                 ` Ian Kent
2007-07-17 17:16                   ` Ingo Molnar
2007-07-18  1:24                     ` Bill Davidsen
2007-07-18  6:19                       ` Ian Kent
2007-07-17 16:30                 ` Chuck Ebbert
2007-07-17 21:16                 ` David Schwartz
2007-07-18  5:59                   ` Ian Kent
2007-07-18  7:54                     ` Ingo Molnar
2007-07-18 13:50                       ` Bill Davidsen
2007-07-18 17:23                       ` Linus Torvalds
2007-07-18 16:03                 ` Linus Torvalds
2007-07-18 17:31                   ` Ian Kent
2007-07-18 21:37                   ` Bill Davidsen
2007-07-19  8:53                     ` Ingo Molnar
2007-07-19 14:32                     ` Ingo Molnar
2007-07-19 17:06                       ` Bill Davidsen
2007-07-19 17:10                         ` Ingo Molnar
2007-07-19 17:17                         ` Ingo Molnar
2007-07-19 17:26                         ` Bill Davidsen
2007-07-19 17:42                           ` Ingo Molnar
2007-07-20  2:32                       ` Bill Davidsen
2007-07-19  8:16                   ` Ingo Molnar [this message]
2007-07-14 11:34 ` Markus
2007-07-14 15:11   ` Markus
2007-07-16  9:41     ` Ingo Molnar
2007-07-16 17:59       ` Markus
2007-07-17  7:37         ` Ingo Molnar
2007-07-17 13:06           ` Markus
2007-07-17 17:06             ` Ingo Molnar
2007-07-17 17:13               ` Ingo Molnar
2007-07-17 19:42               ` Markus
2007-07-17 20:09                 ` Ingo Molnar
2007-07-17 20:37                   ` Linus Torvalds
2007-07-17 20:43                     ` Ingo Molnar
2007-07-17 22:03                       ` Markus
2007-07-20 22:26                       ` Markus
2007-07-22 11:59                         ` konqueror suddenly vanishing, "konqueror: Fatal IO error: client killed" Ingo Molnar
2007-07-22 14:26                           ` Markus
2007-08-09 17:34                       ` [patch] CFS scheduler, -v19 Markus
2007-08-10  7:46                         ` Ingo Molnar
2007-08-14 17:15                           ` Markus
2007-10-17  0:02                       ` Markus
2007-07-14 17:19 ` Ed Tomlinson
2007-07-15  5:25   ` Mike Galbraith
2007-07-15 12:53     ` Markus
2007-07-15 19:46       ` Mike Galbraith
2007-07-15 21:11         ` Markus
2007-07-16  6:42           ` Mike Galbraith
2007-07-16  8:00     ` Ingo Molnar
2007-07-16  9:17   ` Ingo Molnar
2007-07-16 11:10     ` Ed Tomlinson
  -- strict thread matches above, loose matches on Subject: below --
2007-07-08 20:51 Al Boldi

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=20070719081650.GA14299@elte.hu \
    --to=mingo@elte.hu \
    --cc=cebbert@redhat.com \
    --cc=davidsen@tmr.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raven@themaw.net \
    --cc=torvalds@linux-foundation.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.