aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Janousek <tjanouse@redhat.com>2007-07-16 02:39:42 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:41 -0400
commit924b42d5a2dbe508407a0a6290d3751f826bccdd (patch)
treec13a647ae93bcf033bddb713c1e117e84698c679
parent7c3f1a573237b90ef331267260358a0ec4ac9079 (diff)
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. [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>
-rw-r--r--fs/proc/array.c5
-rw-r--r--fs/proc/proc_misc.c6
-rw-r--r--include/linux/sched.h3
-rw-r--r--kernel/fork.c2
4 files changed, 10 insertions, 6 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 98e78e2f18d6..680c913575f0 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)
440 440
441 /* Temporary variable needed for gcc-2.96 */ 441 /* Temporary variable needed for gcc-2.96 */
442 /* convert timespec -> nsec*/ 442 /* convert timespec -> nsec*/
443 start_time = (unsigned long long)task->start_time.tv_sec * NSEC_PER_SEC 443 start_time =
444 + task->start_time.tv_nsec; 444 (unsigned long long)task->real_start_time.tv_sec * NSEC_PER_SEC
445 + task->real_start_time.tv_nsec;
445 /* convert nsec -> ticks */ 446 /* convert nsec -> ticks */
446 start_time = nsec_to_clock_t(start_time); 447 start_time = nsec_to_clock_t(start_time);
447 448
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 5fd49e47f83a..19c9cbf1c320 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)
443 unsigned long jif; 443 unsigned long jif;
444 cputime64_t user, nice, system, idle, iowait, irq, softirq, steal; 444 cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
445 u64 sum = 0; 445 u64 sum = 0;
446 struct timespec boottime;
446 447
447 user = nice = system = idle = iowait = 448 user = nice = system = idle = iowait =
448 irq = softirq = steal = cputime64_zero; 449 irq = softirq = steal = cputime64_zero;
449 jif = - wall_to_monotonic.tv_sec; 450 getboottime(&boottime);
450 if (wall_to_monotonic.tv_nsec) 451 jif = boottime.tv_sec;
451 --jif;
452 452
453 for_each_possible_cpu(i) { 453 for_each_possible_cpu(i) {
454 int j; 454 int j;
diff --git a/include/linux/sched.h b/include/linux/sched.h
index cfb680585ab8..3cffc1204663 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -972,7 +972,8 @@ struct task_struct {
972 unsigned int rt_priority; 972 unsigned int rt_priority;
973 cputime_t utime, stime; 973 cputime_t utime, stime;
974 unsigned long nvcsw, nivcsw; /* context switch counts */ 974 unsigned long nvcsw, nivcsw; /* context switch counts */
975 struct timespec start_time; 975 struct timespec start_time; /* monotonic time */
976 struct timespec real_start_time; /* boot based time */
976/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */ 977/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
977 unsigned long min_flt, maj_flt; 978 unsigned long min_flt, maj_flt;
978 979
diff --git a/kernel/fork.c b/kernel/fork.c
index da3a155bba0d..344d693fdc78 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1059,6 +1059,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1059 1059
1060 p->lock_depth = -1; /* -1 = no lock */ 1060 p->lock_depth = -1; /* -1 = no lock */
1061 do_posix_clock_monotonic_gettime(&p->start_time); 1061 do_posix_clock_monotonic_gettime(&p->start_time);
1062 p->real_start_time = p->start_time;
1063 monotonic_to_bootbased(&p->real_start_time);
1062 p->security = NULL; 1064 p->security = NULL;
1063 p->io_context = NULL; 1065 p->io_context = NULL;
1064 p->io_wait = NULL; 1066 p->io_wait = NULL;