Use boot based time for process start time and boot time in /proc

Commit 411187fb05 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]>
This commit is contained in:
Tomas Janousek 2007-07-15 23:39:42 -07:00 • committed by Linus Torvalds
commit 924b42d5a2
4 changed files with 10 additions and 6 deletions

View 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);

View 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;