Re: [PATCH] Use boot based time for process start time and boottime in /proc

From: Andrew Morton
Date: Thu May 10 2007 - 19:41:24 EST


On Thu, 10 May 2007 19:10:42 +0200
Tomas Janousek <tjanouse@xxxxxxxxxx> wrote:

> Commit 411187fb05cd11676b0979d9fbf3291db69dbce2 caused boot time to move and
> process start times to become invalid after suspend. Using boot based time for
> those restores the old behaviour and fixes the issue.
>
> ..
>
> @@ -445,12 +445,14 @@ static int show_stat(struct seq_file *p, void *v)
> unsigned long jif;
> cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
> u64 sum = 0;
> + struct timespec boottime;
>
> user = nice = system = idle = iowait =
> irq = softirq = steal = cputime64_zero;
> - jif = - wall_to_monotonic.tv_sec;
> - if (wall_to_monotonic.tv_nsec)
> - --jif;
> + getboottime(&boottime);
> + jif = boottime.tv_sec;
> + if (boottime.tv_nsec)
> + ++jif;
>

Is the switch from --jif to ++jif a functional change? If so, how come?

> for_each_possible_cpu(i) {
> int j;
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 40645b4..386ff51 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -918,7 +918,7 @@ struct task_struct {
> unsigned int rt_priority;
> cputime_t utime, stime;
> unsigned long nvcsw, nivcsw; /* context switch counts */
> - struct timespec start_time;
> + struct timespec start_time, real_start_time;

no, please prefer to do

struct timespec start_time;
struct timespec real_start_time;

which gives a nice place to add a comment documenting the field.

Please document fields.

What is the difference between start_time and real_start_time?


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