+ use-boot-based-time-for-process-start-time-and-boot-time.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Use boot based time for process start time and boot time 	in /proc
has been added to the -mm tree.  Its filename is
     use-boot-based-time-for-process-start-time-and-boot-time.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: Use boot based time for process start time and boot time 	in /proc
From: Tomas Janousek <tjanouse@xxxxxxxxxx>

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.

Signed-off-by: Tomas Janousek <tjanouse@xxxxxxxxxx>
Cc: Tomas Smetana <tsmetana@xxxxxxxxxx>
Acked-by: John Stultz <johnstul@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/proc/array.c       |    5 +++--
 fs/proc/proc_misc.c   |    8 +++++---
 include/linux/sched.h |    2 +-
 kernel/fork.c         |    2 ++
 4 files changed, 11 insertions(+), 6 deletions(-)

diff -puN fs/proc/array.c~use-boot-based-time-for-process-start-time-and-boot-time fs/proc/array.c
--- a/fs/proc/array.c~use-boot-based-time-for-process-start-time-and-boot-time
+++ a/fs/proc/array.c
@@ -405,8 +405,9 @@ static int do_task_stat(struct task_stru
 
 	/* 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 -puN fs/proc/proc_misc.c~use-boot-based-time-for-process-start-time-and-boot-time fs/proc/proc_misc.c
--- a/fs/proc/proc_misc.c~use-boot-based-time-for-process-start-time-and-boot-time
+++ a/fs/proc/proc_misc.c
@@ -445,12 +445,14 @@ static int show_stat(struct seq_file *p,
 	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;
 
 	for_each_possible_cpu(i) {
 		int j;
diff -puN include/linux/sched.h~use-boot-based-time-for-process-start-time-and-boot-time include/linux/sched.h
--- a/include/linux/sched.h~use-boot-based-time-for-process-start-time-and-boot-time
+++ a/include/linux/sched.h
@@ -900,7 +900,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;
 /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
 	unsigned long min_flt, maj_flt;
 
diff -puN kernel/fork.c~use-boot-based-time-for-process-start-time-and-boot-time kernel/fork.c
--- a/kernel/fork.c~use-boot-based-time-for-process-start-time-and-boot-time
+++ a/kernel/fork.c
@@ -1058,6 +1058,8 @@ static struct task_struct *copy_process(
 
 	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;
_

Patches currently in -mm which might be from tjanouse@xxxxxxxxxx are

introduce-boot-based-time.patch
introduce-boot-based-time-fix.patch
use-boot-based-time-for-process-start-time-and-boot-time.patch
use-boot-based-time-for-process-start-time-and-boot-time-fix.patch
use-boot-based-time-for-uptime-in-proc.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux