All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] posix_cpu_timers_exit_group: do not use thread_group_cputimer()
@ 2009-06-17 13:36 Stanislaw Gruszka
  2009-06-17 14:02 ` Oleg Nesterov
  0 siblings, 1 reply; 2+ messages in thread
From: Stanislaw Gruszka @ 2009-06-17 13:36 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Peter Zijlstra, Roland McGrath, Vitaly Mayatskikh, linux-kernel,
	Oleg Nesterov

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);
 }
 
 static void clear_dead_task(struct k_itimer *timer, union cpu_time_count now)
-- 
1.5.5.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] posix_cpu_timers_exit_group: do not use thread_group_cputimer()
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Oleg Nesterov @ 2009-06-17 14:02 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: Andrew Morton, Peter Zijlstra, Roland McGrath, Vitaly Mayatskikh,
	linux-kernel

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-17 14:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.