]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Use boot based time for process start time and boot time in /proc
authorTomas Janousek <tjanouse@redhat.com>
Mon, 16 Jul 2007 06:39:42 +0000 (23:39 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 16 Jul 2007 16:05:41 +0000 (09:05 -0700)
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.

[akpm@linux-foundation.org: little cleanup]
Signed-off-by: Tomas Janousek <tjanouse@redhat.com>
Cc: Tomas Smetana <tsmetana@redhat.com>
Acked-by: John Stultz <johnstul@us.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/array.c
fs/proc/proc_misc.c
include/linux/sched.h
kernel/fork.c

index 98e78e2f18d66cb4331d394c8543c3e8db4445a4..680c913575f0bd41ea7374929258d21cecb5f75d 100644 (file)
@@ -440,8 +440,9 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole)
 
        /* Temporary variable needed for gcc-2.96 */
        /* convert timespec -> nsec*/
-       start_time = (unsigned long long)task->start_time.tv_sec * NSEC_PER_SEC
-                               + task->start_time.tv_nsec;
+       start_time =
+               (unsigned long long)task->real_start_time.tv_sec * NSEC_PER_SEC
+                               + task->real_start_time.tv_nsec;
        /* convert nsec -> ticks */
        start_time = nsec_to_clock_t(start_time);
 
index 5fd49e47f83a7c8a1d20ee07d6d6e13d0df9d6ab..19c9cbf1c320e24f1f05d5730d6c93651ae91af7 100644 (file)
@@ -443,12 +443,12 @@ 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;
 
        for_each_possible_cpu(i) {
                int j;
index cfb680585ab8bd87762fe3e9b2bedfb404882760..3cffc120466394926fe1eedbcfdf5e9b5b0ced4c 100644 (file)
@@ -972,7 +972,8 @@ 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;             /* monotonic time */
+       struct timespec real_start_time;        /* boot based time */
 /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
        unsigned long min_flt, maj_flt;
 
index da3a155bba0ddc5c50a8082833a90be6fe60e8ce..344d693fdc787c153ca702a3d3481031164a964a 100644 (file)
@@ -1059,6 +1059,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 
        p->lock_depth = -1;             /* -1 = no lock */
        do_posix_clock_monotonic_gettime(&p->start_time);
+       p->real_start_time = p->start_time;
+       monotonic_to_bootbased(&p->real_start_time);
        p->security = NULL;
        p->io_context = NULL;
        p->io_wait = NULL;