lkml.org 
[lkml]   [2004]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Re: boot time, process start time, and NOW time
On Tue, 17 Aug 2004, john stultz wrote:

> On Tue, 2004-08-17 at 15:24, George Anzinger wrote:
> > I see you think you have the solution, but I guess I am just dense here. May be
> > you could help me to see the error of my ways. Here is my thinking:
> >
> > "now" is from gettimeofday() and as such is ntp corrected.
> > "uptime" is also corrected. In fact it is "now" + "wall_to_monotonic". And
> > "wall_to_monotonic" is _only_ changed by do_settime() when the clock is set.
> > "time_from_boot_to_process_start" is the same as "start_time" restated in
> > seconds, i.e. it is a constant. So, either one or more of the above assumtions
> > is wrong, or somebody is twiddling the clock. Otherwise I don't see how the
> > start time can move at all.

Start time indeed is a constant for each process, and doesn't drift.
The problem trather is that a (slightly) wrong start time is assigned
to newly created processes.

> The problem is start time is derived from task->start_time which is the
> jiffies value at the time the process started. Thus interval calculated
> by: (start_time = p->start_time - INITIAL_JIFFIES) or (run_time =
> get_jiffies_64() - p->start_time) is not NTP adjusted.
>
> So both (uptime - run_time) or (boot_time + start_time) will have
> problems.
>
> What needs to happen is task->start_time is changed to a timespec which
> is set at fork time to be do_posix_clock_monotonic_gettime(). Then in
> proc_pid_stat() we can calculate the appropriate user-jiffies value.

Yep.

> task->start_time is used at the following lines:
>
> include/linux/sched.h: 460
> kernel/fork.c: 964
> fs/proc/array.h: 359
> kernel/acct.c: 404
> mm/oom_kill.c: 64
>
> I'm stuck trying to fix the last two files at the moment. Please let me
> know if you see any other uses.

Where's the problem with the last two of them?
I think I can do them if you fix the first three, so that I can see which
time source is going to replace jiffies here.


Tim
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:05    [W:0.675 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site