public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] wait_task_zombie: do not use thread_group_cputime()
@ 2009-06-15 21:26 Oleg Nesterov
  2009-06-16  0:47 ` Roland McGrath
  2009-06-17  8:13 ` Stanislaw Gruszka
  0 siblings, 2 replies; 4+ messages in thread
From: Oleg Nesterov @ 2009-06-15 21:26 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Peter Zijlstra, Roland McGrath, Stanislaw Gruszka,
	Vitaly Mayatskikh, linux-kernel

There is no reason for thread_group_cputime() in wait_task_zombie(),
there must be no other threads.

This call was previously needed to collect the per-cpu data which
we do not have any longer.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>

--- PTRACE/kernel/exit.c~2_WAIT_NO_TG	2009-06-15 22:26:02.000000000 +0200
+++ PTRACE/kernel/exit.c	2009-06-15 23:06:45.000000000 +0200
@@ -1192,7 +1192,6 @@ static int wait_task_zombie(struct wait_
 	if (likely(!traced) && likely(!task_detached(p))) {
 		struct signal_struct *psig;
 		struct signal_struct *sig;
-		struct task_cputime cputime;
 
 		/*
 		 * The resource counters for the group leader are in its
@@ -1208,23 +1207,20 @@ static int wait_task_zombie(struct wait_
 		 * need to protect the access to parent->signal fields,
 		 * as other threads in the parent group can be right
 		 * here reaping other children at the same time.
-		 *
-		 * We use thread_group_cputime() to get times for the thread
-		 * group, which consolidates times for all threads in the
-		 * group including the group leader.
 		 */
-		thread_group_cputime(p, &cputime);
 		spin_lock_irq(&p->real_parent->sighand->siglock);
 		psig = p->real_parent->signal;
 		sig = p->signal;
 		psig->cutime =
 			cputime_add(psig->cutime,
-			cputime_add(cputime.utime,
-				    sig->cutime));
+			cputime_add(p->utime,
+			cputime_add(sig->utime,
+				    sig->cutime)));
 		psig->cstime =
 			cputime_add(psig->cstime,
-			cputime_add(cputime.stime,
-				    sig->cstime));
+			cputime_add(p->stime,
+			cputime_add(sig->stime,
+				    sig->cstime)));
 		psig->cgtime =
 			cputime_add(psig->cgtime,
 			cputime_add(p->gtime,


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

* Re: [PATCH 2/2] wait_task_zombie: do not use thread_group_cputime()
  2009-06-15 21:26 [PATCH 2/2] wait_task_zombie: do not use thread_group_cputime() Oleg Nesterov
@ 2009-06-16  0:47 ` Roland McGrath
  2009-06-17  8:13 ` Stanislaw Gruszka
  1 sibling, 0 replies; 4+ messages in thread
From: Roland McGrath @ 2009-06-16  0:47 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Peter Zijlstra, Stanislaw Gruszka,
	Vitaly Mayatskikh, linux-kernel

Acked-by: Roland McGrath <roland@redhat.com>

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

* Re: [PATCH 2/2] wait_task_zombie: do not use thread_group_cputime()
  2009-06-15 21:26 [PATCH 2/2] wait_task_zombie: do not use thread_group_cputime() Oleg Nesterov
  2009-06-16  0:47 ` Roland McGrath
@ 2009-06-17  8:13 ` Stanislaw Gruszka
  2009-06-17 12:23   ` Oleg Nesterov
  1 sibling, 1 reply; 4+ messages in thread
From: Stanislaw Gruszka @ 2009-06-17  8:13 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Peter Zijlstra, Roland McGrath, Vitaly Mayatskikh,
	linux-kernel

On Mon, 15 Jun 2009 23:26:51 +0200
Oleg Nesterov <oleg@redhat.com> wrote:

> There is no reason for thread_group_cputime() in wait_task_zombie(),
> there must be no other threads.
> 
> This call was previously needed to collect the per-cpu data which
> we do not have any longer.

Is similar change for posix_cpu_timers_exit_group() correct and worthwhile ?

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

Regards
Stanislaw

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

* Re: [PATCH 2/2] wait_task_zombie: do not use thread_group_cputime()
  2009-06-17  8:13 ` Stanislaw Gruszka
@ 2009-06-17 12:23   ` Oleg Nesterov
  0 siblings, 0 replies; 4+ messages in thread
From: Oleg Nesterov @ 2009-06-17 12:23 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: Andrew Morton, Peter Zijlstra, Roland McGrath, Vitaly Mayatskikh,
	linux-kernel

On 06/17, Stanislaw Gruszka wrote:
>
> On Mon, 15 Jun 2009 23:26:51 +0200
> Oleg Nesterov <oleg@redhat.com> wrote:
>
> > There is no reason for thread_group_cputime() in wait_task_zombie(),
> > there must be no other threads.
> >
> > This call was previously needed to collect the per-cpu data which
> > we do not have any longer.
>
> Is similar change for posix_cpu_timers_exit_group() correct and worthwhile ?
>
>  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);
>  }

Yes, I think you are right.

And I think thread_group_cputimer() was never needed, it should be
thread_group_cputime(). Which in turn is not needed any longer too.

Please re-send with changelog/subject ?

Oleg.


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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-15 21:26 [PATCH 2/2] wait_task_zombie: do not use thread_group_cputime() Oleg Nesterov
2009-06-16  0:47 ` Roland McGrath
2009-06-17  8:13 ` Stanislaw Gruszka
2009-06-17 12:23   ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox