From: john stultz <johnstul@us.ibm.com>
To: Tomas Janousek <tjanouse@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, tsmetana@redhat.com,
riel@redhat.com
Subject: Re: [PATCH] Use boot based time for process start time and boot time in /proc
Date: Thu, 10 May 2007 11:44:31 -0700 [thread overview]
Message-ID: <1178822672.6011.3.camel@localhost.localdomain> (raw)
In-Reply-To: <f3c12bbf0772543db18c7a5251ce92f4f4f6758e.1178816485.git.tomi@nomi.cz>
On Thu, 2007-05-10 at 19:10 +0200, Tomas Janousek wrote:
> 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@redhat.com>
> Cc: Tomas Smetana <tsmetana@redhat.com>
> Cc: John Stultz <johnstul@us.ibm.com>
Acked-by: John Stultz <johnstul@us.ibm.com>
> ---
> 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 --git a/fs/proc/array.c b/fs/proc/array.c
> index 74f30e0..e798e11 100644
> --- a/fs/proc/array.c
> +++ b/fs/proc/array.c
> @@ -405,8 +405,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 4636be7..0782d34 100644
> --- a/fs/proc/proc_misc.c
> +++ b/fs/proc/proc_misc.c
> @@ -445,12 +445,14 @@ 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;
> + if (boottime.tv_nsec)
> + ++jif;
>
> for_each_possible_cpu(i) {
> int j;
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 40645b4..386ff51 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -918,7 +918,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 --git a/kernel/fork.c b/kernel/fork.c
> index 4239de2..3aa82bc 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;
> --
> 1.5.1.4
>
>
next prev parent reply other threads:[~2007-05-10 18:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-03 15:03 Broken process startup times after suspend (regression) Tomas Janousek
2007-05-03 19:59 ` john stultz
2007-05-04 16:13 ` Tomas Janousek
2007-05-04 18:18 ` john stultz
2007-05-04 19:09 ` Tomas Janousek
2007-05-10 17:10 ` [PATCH] Introduce boot based time Tomas Janousek
2007-05-10 17:10 ` [PATCH] Use boot based time for process start time and boot time in /proc Tomas Janousek
2007-05-10 18:44 ` john stultz [this message]
2007-05-10 23:40 ` Andrew Morton
2007-05-11 8:45 ` Tomas Janousek
2007-05-11 19:51 ` Andrew Morton
2007-05-11 23:37 ` Tomas Janousek
2007-05-11 8:46 ` Tomas Janousek
2007-05-10 17:10 ` [PATCH] Use boot based time for uptime " Tomas Janousek
2007-05-10 18:47 ` john stultz
2007-05-10 18:42 ` [PATCH] Introduce boot based time john stultz
2007-05-10 19:48 ` Ingo Oeser
2007-05-10 20:00 ` Tomas Janousek
2007-05-10 20:02 ` john stultz
2007-05-10 22:22 ` Ingo Oeser
2007-05-10 23:40 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1178822672.6011.3.camel@localhost.localdomain \
--to=johnstul@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=riel@redhat.com \
--cc=tjanouse@redhat.com \
--cc=tsmetana@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox