Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=924b42d5a2dbe508407a0a6290d3751f826bccdd
Commit:     924b42d5a2dbe508407a0a6290d3751f826bccdd
Parent:     7c3f1a573237b90ef331267260358a0ec4ac9079
Author:     Tomas Janousek <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 15 23:39:42 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Jul 16 09:05:41 2007 -0700

    Use boot based time for process start time and boot time in /proc
    
    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.
    
    [EMAIL PROTECTED]: little cleanup]
    Signed-off-by: Tomas Janousek <[EMAIL PROTECTED]>
    Cc: Tomas Smetana <[EMAIL PROTECTED]>
    Acked-by: John Stultz <[EMAIL PROTECTED]>
    Cc: Thomas Gleixner <[EMAIL PROTECTED]>
    Cc: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/proc/array.c       |    5 +++--
 fs/proc/proc_misc.c   |    6 +++---
 include/linux/sched.h |    3 ++-
 kernel/fork.c         |    2 ++
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/fs/proc/array.c b/fs/proc/array.c
index 98e78e2..680c913 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -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);
 
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 5fd49e4..19c9cbf 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -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;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index cfb6805..3cffc12 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -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;
 
diff --git a/kernel/fork.c b/kernel/fork.c
index da3a155..344d693 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -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;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to