All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Roland McGrath <roland@redhat.com>,
	Vitaly Mayatskikh <vmayatsk@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] posix_cpu_timers_exit_group: do not use thread_group_cputimer()
Date: Wed, 17 Jun 2009 16:02:05 +0200	[thread overview]
Message-ID: <20090617140205.GA8632@redhat.com> (raw)
In-Reply-To: <20090617153637.3342988c@dhcp-lab-109.englab.brq.redhat.com>

On 06/17, Stanislaw Gruszka wrote:
>
> When the process exits we don't have to run new cputimer nor use running one
> (as it not accounts when tsk->exit_state != 0) to get process CPU times.
> As there is only one thread we can just use CPU times fields form task
> and signal structs.
>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
>  kernel/posix-cpu-timers.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
> index bece7c0..e33a21c 100644
> --- a/kernel/posix-cpu-timers.c
> +++ b/kernel/posix-cpu-timers.c
> @@ -521,11 +521,12 @@ void posix_cpu_timers_exit(struct task_struct *tsk)
>  }
>  void posix_cpu_timers_exit_group(struct task_struct *tsk)
>  {
> -	struct task_cputime cputime;
> +	struct signal_struct *const sig = tsk->signal;
>
> -	thread_group_cputimer(tsk, &cputime);
>  	cleanup_timers(tsk->signal->cpu_timers,
> -		       cputime.utime, cputime.stime, cputime.sum_exec_runtime);
> +		       cputime_add(tsk->utime, sig->utime),
> +		       cputime_add(tsk->stime, sig->stime),
> +		       tsk->se.sum_exec_runtime + sig->sum_sched_runtime);
>  }

I think this is correct.

Oleg.


      reply	other threads:[~2009-06-17 14:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-17 13:36 [PATCH] posix_cpu_timers_exit_group: do not use thread_group_cputimer() Stanislaw Gruszka
2009-06-17 14:02 ` Oleg Nesterov [this message]

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=20090617140205.GA8632@redhat.com \
    --to=oleg@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    --cc=sgruszka@redhat.com \
    --cc=vmayatsk@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.