public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: George Anzinger <george@mvista.com>
To: john stultz <johnstul@us.ibm.com>
Cc: Tim Schmielau <tim@physik3.uni-rostock.de>,
	Andrew Morton <akpm@osdl.org>,
	OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
	albert@users.sourceforge.net, lkml <linux-kernel@vger.kernel.org>,
	voland@dmz.com.pl, nicolas.george@ens.fr,
	kaukasoi@elektroni.ee.tut.fi, david+powerix@blue-labs.org
Subject: Re: boot time, process start time, and NOW time
Date: Mon, 16 Aug 2004 17:37:08 -0700	[thread overview]
Message-ID: <41215334.7050203@mvista.com> (raw)
In-Reply-To: <1092702077.2429.88.camel@cog.beaverton.ibm.com>

john stultz wrote:
> On Mon, 2004-08-16 at 16:08, Tim Schmielau wrote:
> 
>>On Mon, 16 Aug 2004, Andrew Morton wrote:
>>
>>
>>>OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> wrote:
>>>
>>>>Albert Cahalan <albert@users.sf.net> writes:
>>>>
>>>>
>>>>>Even with the 2.6.7 kernel, I'm still getting reports of process
>>>>>start times wandering. Here is an example:
>>>>>
>>>>>   "About 12 hours since reboot to 2.6.7 there was already a
>>>>>   difference of about 7 seconds between the real start time
>>>>>   and the start time reported by ps. Now, 24 hours since reboot
>>>>>   the difference is 10 seconds."
>>>>>
>>>>>The calculation used is:
>>>>>
>>>>>   now - uptime + time_from_boot_to_process_start
>>>>
>>>>Start-time and uptime is using different source. Looks like the
>>>>jiffies was added bogus lost counts.
>>>>
>>>>quick hack. Does this change the behavior?
>>>
>>>Where did this all end up?  Complaints about wandering start times are
>>>persistent, and it'd be nice to get some fix in place...
>>
>>
>>
>>The trouble seems to be due to the patch below, part of a larger cleanup
>>(http://linus.bkbits.net:8080/linux-2.5/cset%403ef4851dGg0fxX58R9Zv8SIq9fzNmQ?nav=index.html|src/.|src/fs|src/fs/proc|related/fs/proc/proc_misc.c)
>>by George.
>>
>>Quoting from the changelog entry:
>>
>>"Changes the uptime code to use the posix_clock_monotonic notion of 
>>uptime instead of the jiffies.  This time will track NTP changes and so should 
>>be better than your standard wristwatch (if your using ntp)."
>>
>>George is absolutely right that it's more precise. However, it's also 
>>inconsistent with the process start times which use plain uncorrected 
>>jiffies. ps stumbles over this inconsistency.
>>
>>Simple fix: revert the patch below.
>>Complicated fix: correct process start times in fork.c (no patch provided, 
>>too complicated for me to do).
> 
> 
> Hmm. While that patch fixed the uptime proc entry, I thought the issue
> was with process start times. I'm looking at fixing the start_time
> assignment in proc_pid_stat(). My suspicion is that we need to use ACTHZ
> in jiffies64_to_clock_t().

I really don't see how the start_time that proc_pid_stat() is producing could be 
anything but a constant.  The complaint is that it moves, not that it is 
incorrect, right?
> 
> Something like the patch below.
> 
> thanks
> -john
> 
> ===== include/linux/times.h 1.6 vs edited =====
> --- 1.6/include/linux/times.h	2004-05-10 04:25:49 -07:00
> +++ edited/include/linux/times.h	2004-08-16 16:22:13 -07:00
> @@ -48,6 +48,7 @@
>  	 * but even this doesn't overflow in hundreds of years
>  	 * in 64 bits, so..
>  	 */
> +	x = (x * ACT_HZ)>>8;  /* compensate for ACT_HZ != HZ */
>  	x *= TICK_NSEC;
>  	do_div(x, (NSEC_PER_SEC / USER_HZ));
>  #endif
> 
> 

-- 
George Anzinger   george@mvista.com
High-res-timers:  http://sourceforge.net/projects/high-res-timers/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml


  reply	other threads:[~2004-08-17  0:37 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-22 23:57 boot time, process start time, and NOW time Albert Cahalan
2004-06-28 17:56 ` OGAWA Hirofumi
2004-08-16 19:41   ` Andrew Morton
2004-08-16 21:49     ` john stultz
2004-08-16 23:08     ` Tim Schmielau
2004-08-16 23:56       ` Tim Schmielau
2004-08-17  0:21       ` john stultz
2004-08-17  0:37         ` George Anzinger [this message]
2004-08-17  0:49           ` john stultz
2004-08-17  0:31       ` George Anzinger
2004-08-16 22:32         ` Albert Cahalan
2004-08-17  1:26           ` George Anzinger
2004-08-16 23:08             ` Albert Cahalan
2004-08-17  1:54               ` James Courtier-Dutton
2004-08-17  2:03                 ` Lee Revell
2004-08-17 20:52                 ` George Anzinger
2004-08-17  6:56         ` Tim Schmielau
2004-08-17 20:07           ` john stultz
2004-08-17 20:13             ` [RFC] New timeofday implementation proposal john stultz
2004-08-17 20:58               ` [RFC] New timeofday code john stultz
2004-09-01 23:16               ` [RFC] New timeofday implementation proposal Christoph Lameter
2004-08-16 23:24     ` boot time, process start time, and NOW time Albert Cahalan
2004-08-17 19:00       ` john stultz
2004-08-17 17:41         ` Albert Cahalan
2004-08-17 20:58           ` john stultz
2004-08-17 20:25     ` [PATCH] " Tim Schmielau
2004-08-17 22:24       ` George Anzinger
2004-08-17 22:37         ` john stultz
2004-08-17 23:07           ` Tim Schmielau
2004-08-18  0:11             ` john stultz
2004-08-17 22:19               ` Albert Cahalan
2004-08-18  1:09                 ` john stultz
2004-08-17 22:45                   ` Albert Cahalan
2004-08-18  7:42                   ` Tim Schmielau
2004-08-19 19:15                     ` Petri Kaukasoina
2004-08-26 11:04                       ` Andrew Morton
2004-08-26 12:07                         ` Tim Schmielau
2004-08-30 23:00                           ` Tim Schmielau
2004-08-30 23:38                             ` john stultz
2004-08-31  0:37                               ` Albert Cahalan
2004-08-31  0:49                                 ` Tim Schmielau
2004-08-31  0:45                               ` Tim Schmielau
2004-08-31  1:23                                 ` john stultz
2004-08-31  1:34                             ` john stultz
2004-08-31  6:07                               ` Tim Schmielau
2004-08-31 19:27                                 ` George Anzinger
2004-08-31 20:56                                   ` john stultz
2004-08-31 21:10                                     ` David Ford
2004-09-02 20:39                                     ` George Anzinger
2004-09-01 19:14                                 ` OGAWA Hirofumi
2004-09-02 20:58                                   ` George Anzinger
2004-09-02 21:38                                     ` OGAWA Hirofumi
2004-09-03  0:59                                       ` George Anzinger
2004-09-03  3:35                                         ` OGAWA Hirofumi
2004-09-03  7:31                                           ` George Anzinger
2004-09-03  7:51                                             ` Tim Schmielau
2004-09-03  7:15                                       ` Tim Schmielau

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=41215334.7050203@mvista.com \
    --to=george@mvista.com \
    --cc=akpm@osdl.org \
    --cc=albert@users.sourceforge.net \
    --cc=david+powerix@blue-labs.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=johnstul@us.ibm.com \
    --cc=kaukasoi@elektroni.ee.tut.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.george@ens.fr \
    --cc=tim@physik3.uni-rostock.de \
    --cc=voland@dmz.com.pl \
    /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