public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 2/4] coredump: speedup SIGKILL sending
  2006-04-06 22:06 [PATCH 2/4] coredump: speedup SIGKILL sending Oleg Nesterov
@ 2006-04-06 19:45 ` Lee Revell
  2006-04-06 23:55   ` Oleg Nesterov
  2006-04-10  4:11 ` Roland McGrath
  1 sibling, 1 reply; 7+ messages in thread
From: Lee Revell @ 2006-04-06 19:45 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Eric W. Biederman, Ingo Molnar, Paul E. McKenney,
	Roland McGrath, linux-kernel

On Fri, 2006-04-07 at 02:06 +0400, Oleg Nesterov wrote:
> With this patch a thread group is killed atomically under ->siglock.
> This is faster because we can use sigaddset() instead of force_sig_info()
> and this is used in further patches.
> 
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

Won't this cause huge latencies when a process with lots of threads is
killed?

Lee


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

* Re: [PATCH 2/4] coredump: speedup SIGKILL sending
  2006-04-06 23:55   ` Oleg Nesterov
@ 2006-04-06 20:07     ` Lee Revell
  2006-04-07 23:28       ` Oleg Nesterov
  0 siblings, 1 reply; 7+ messages in thread
From: Lee Revell @ 2006-04-06 20:07 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Eric W. Biederman, Ingo Molnar, Paul E. McKenney,
	Roland McGrath, linux-kernel

On Fri, 2006-04-07 at 03:55 +0400, Oleg Nesterov wrote:
> On 04/06, Lee Revell wrote:
> > On Fri, 2006-04-07 at 02:06 +0400, Oleg Nesterov wrote:
> > > With this patch a thread group is killed atomically under ->siglock.
> > > This is faster because we can use sigaddset() instead of force_sig_info()
> > > and this is used in further patches.
> > > 
> > > Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
> > 
> > Won't this cause huge latencies when a process with lots of threads is
> > killed?
> 
> Yes, irqs are disabled. But this is not worse than 'kill -9 pid', note
> that __group_complete_signal() or zap_other_threads() do the same.

Those have been problematic in the past.  I am just wondering if this
will be a latency regression, or if changes elsewhere in your patch
negate the effect.

I'm just concerned because it was a lot of work over ~2 years to get 2.6
to perform decently in this area, and we have regressed since 2.6.14 (VM
issue).

Lee


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

* [PATCH 2/4] coredump: speedup SIGKILL sending
@ 2006-04-06 22:06 Oleg Nesterov
  2006-04-06 19:45 ` Lee Revell
  2006-04-10  4:11 ` Roland McGrath
  0 siblings, 2 replies; 7+ messages in thread
From: Oleg Nesterov @ 2006-04-06 22:06 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Eric W. Biederman, Ingo Molnar, Paul E. McKenney, Roland McGrath,
	linux-kernel

With this patch a thread group is killed atomically under ->siglock.
This is faster because we can use sigaddset() instead of force_sig_info()
and this is used in further patches.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- rc1/fs/exec.c~2_KILL	2006-04-06 15:10:28.000000000 +0400
+++ rc1/fs/exec.c	2006-04-06 15:19:33.000000000 +0400
@@ -1387,17 +1387,24 @@ static void format_corename(char *corena
 static void zap_process(struct task_struct *start, int *ptraced)
 {
 	struct task_struct *t;
+	unsigned long flags;
+
+	spin_lock_irqsave(&start->sighand->siglock, flags);
 
 	t = start;
 	do {
 		if (t != current && t->mm) {
 			t->mm->core_waiters++;
-			force_sig_specific(SIGKILL, t);
+			sigaddset(&t->pending.signal, SIGKILL);
+			signal_wake_up(t, 1);
+
 			if (unlikely(t->ptrace) &&
 			    unlikely(t->parent->mm == t->mm))
 				*ptraced = 1;
 		}
 	} while ((t = next_thread(t)) != start);
+
+	spin_unlock_irqrestore(&start->sighand->siglock, flags);
 }
 
 static void zap_threads (struct mm_struct *mm)


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

* Re: [PATCH 2/4] coredump: speedup SIGKILL sending
  2006-04-06 19:45 ` Lee Revell
@ 2006-04-06 23:55   ` Oleg Nesterov
  2006-04-06 20:07     ` Lee Revell
  0 siblings, 1 reply; 7+ messages in thread
From: Oleg Nesterov @ 2006-04-06 23:55 UTC (permalink / raw)
  To: Lee Revell
  Cc: Andrew Morton, Eric W. Biederman, Ingo Molnar, Paul E. McKenney,
	Roland McGrath, linux-kernel

On 04/06, Lee Revell wrote:
> On Fri, 2006-04-07 at 02:06 +0400, Oleg Nesterov wrote:
> > With this patch a thread group is killed atomically under ->siglock.
> > This is faster because we can use sigaddset() instead of force_sig_info()
> > and this is used in further patches.
> > 
> > Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
> 
> Won't this cause huge latencies when a process with lots of threads is
> killed?

Yes, irqs are disabled. But this is not worse than 'kill -9 pid', note
that __group_complete_signal() or zap_other_threads() do the same.

Oleg.


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

* Re: [PATCH 2/4] coredump: speedup SIGKILL sending
  2006-04-07 23:28       ` Oleg Nesterov
@ 2006-04-07 19:42         ` Lee Revell
  0 siblings, 0 replies; 7+ messages in thread
From: Lee Revell @ 2006-04-07 19:42 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Eric W. Biederman, Ingo Molnar, Paul E. McKenney,
	Roland McGrath, linux-kernel

On Sat, 2006-04-08 at 03:28 +0400, Oleg Nesterov wrote:
> zap_process() disables irqs while traversing ->thread_group list.
> So yes, if a process has a lot of threads it will be a latency regression.
> (but again, __group_complete_signal() does the same while delivering this
> signal, so I don't think this change can make things worse).
> 
> However this allows us to avoid tasklist_lock in zap_threads() so I think
> it is worth it. Please note that tasklist_lock was held while iterating
> over _all_ threads in system, not only current's thread group.
> 

OK sounds good.

Lee


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

* Re: [PATCH 2/4] coredump: speedup SIGKILL sending
  2006-04-06 20:07     ` Lee Revell
@ 2006-04-07 23:28       ` Oleg Nesterov
  2006-04-07 19:42         ` Lee Revell
  0 siblings, 1 reply; 7+ messages in thread
From: Oleg Nesterov @ 2006-04-07 23:28 UTC (permalink / raw)
  To: Lee Revell
  Cc: Andrew Morton, Eric W. Biederman, Ingo Molnar, Paul E. McKenney,
	Roland McGrath, linux-kernel

On 04/06, Lee Revell wrote:
> On Fri, 2006-04-07 at 03:55 +0400, Oleg Nesterov wrote:
> > On 04/06, Lee Revell wrote:
> > > On Fri, 2006-04-07 at 02:06 +0400, Oleg Nesterov wrote:
> > > > With this patch a thread group is killed atomically under ->siglock.
> > > > This is faster because we can use sigaddset() instead of force_sig_info()
> > > > and this is used in further patches.
> > > >
> > > > Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
> > >
> > > Won't this cause huge latencies when a process with lots of threads is
> > > killed?
> >
> > Yes, irqs are disabled. But this is not worse than 'kill -9 pid', note
> > that __group_complete_signal() or zap_other_threads() do the same.
>
> Those have been problematic in the past.  I am just wondering if this
> will be a latency regression, or if changes elsewhere in your patch
> negate the effect.

zap_process() disables irqs while traversing ->thread_group list.
So yes, if a process has a lot of threads it will be a latency regression.
(but again, __group_complete_signal() does the same while delivering this
signal, so I don't think this change can make things worse).

However this allows us to avoid tasklist_lock in zap_threads() so I think
it is worth it. Please note that tasklist_lock was held while iterating
over _all_ threads in system, not only current's thread group.

Oleg.


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

* Re: [PATCH 2/4] coredump: speedup SIGKILL sending
  2006-04-06 22:06 [PATCH 2/4] coredump: speedup SIGKILL sending Oleg Nesterov
  2006-04-06 19:45 ` Lee Revell
@ 2006-04-10  4:11 ` Roland McGrath
  1 sibling, 0 replies; 7+ messages in thread
From: Roland McGrath @ 2006-04-10  4:11 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Eric W. Biederman, Ingo Molnar, Paul E. McKenney,
	linux-kernel

> With this patch a thread group is killed atomically under ->siglock.
> This is faster because we can use sigaddset() instead of force_sig_info()
> and this is used in further patches.
> 
> Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

Looks good to me.

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


Thanks,
Roland

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

end of thread, other threads:[~2006-04-10  4:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-06 22:06 [PATCH 2/4] coredump: speedup SIGKILL sending Oleg Nesterov
2006-04-06 19:45 ` Lee Revell
2006-04-06 23:55   ` Oleg Nesterov
2006-04-06 20:07     ` Lee Revell
2006-04-07 23:28       ` Oleg Nesterov
2006-04-07 19:42         ` Lee Revell
2006-04-10  4:11 ` Roland McGrath

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