public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] __down_common: use signal_pending_state()
@ 2008-06-04 17:09 Oleg Nesterov
  2008-06-04 17:36 ` Matthew Wilcox
  0 siblings, 1 reply; 5+ messages in thread
From: Oleg Nesterov @ 2008-06-04 17:09 UTC (permalink / raw)
  To: Andrew Morton, Ingo Molnar
  Cc: Dmitry Adamushko, Matthew Wilcox, Peter Zijlstra, Roland McGrath,
	linux-kernel

Cleanup. __down_common() can use the new signal_pending_state() helper.

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

--- 26-rc2/kernel/semaphore.c~2_SEM_USE_HELPER	2008-05-18 15:44:19.000000000 +0400
+++ 26-rc2/kernel/semaphore.c	2008-06-04 20:45:21.000000000 +0400
@@ -211,9 +211,7 @@ static inline int __sched __down_common(
 	waiter.up = 0;
 
 	for (;;) {
-		if (state == TASK_INTERRUPTIBLE && signal_pending(task))
-			goto interrupted;
-		if (state == TASK_KILLABLE && fatal_signal_pending(task))
+		if (signal_pending_state(state, task))
 			goto interrupted;
 		if (timeout <= 0)
 			goto timed_out;


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

* Re: [PATCH 2/2] __down_common: use signal_pending_state()
  2008-06-04 17:09 [PATCH 2/2] __down_common: use signal_pending_state() Oleg Nesterov
@ 2008-06-04 17:36 ` Matthew Wilcox
  2008-06-04 18:08   ` Oleg Nesterov
  2008-06-09 13:20   ` Ingo Molnar
  0 siblings, 2 replies; 5+ messages in thread
From: Matthew Wilcox @ 2008-06-04 17:36 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Ingo Molnar, Dmitry Adamushko, Peter Zijlstra,
	Roland McGrath, linux-kernel

On Wed, Jun 04, 2008 at 09:09:06PM +0400, Oleg Nesterov wrote:
> Cleanup. __down_common() can use the new signal_pending_state() helper.

This is a bad optimisation.  __down_common gets inlined and the constant
'state' versions are optimised away for the versions which don't apply.

NAK this patch.

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

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

* Re: [PATCH 2/2] __down_common: use signal_pending_state()
  2008-06-04 17:36 ` Matthew Wilcox
@ 2008-06-04 18:08   ` Oleg Nesterov
  2008-06-04 19:54     ` Matthew Wilcox
  2008-06-09 13:20   ` Ingo Molnar
  1 sibling, 1 reply; 5+ messages in thread
From: Oleg Nesterov @ 2008-06-04 18:08 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Andrew Morton, Ingo Molnar, Dmitry Adamushko, Peter Zijlstra,
	Roland McGrath, linux-kernel

On 06/04, Matthew Wilcox wrote:
>
> On Wed, Jun 04, 2008 at 09:09:06PM +0400, Oleg Nesterov wrote:
> > Cleanup. __down_common() can use the new signal_pending_state() helper.
>
> This is a bad optimisation.  __down_common gets inlined and the constant
> 'state' versions are optimised away for the versions which don't apply.
>
> NAK this patch.

OK.

But this was not optimisation, just code re-use.

Actually, I don't understand why __down_common/__mutex_lock_common are inlines,
perhaps it is better to shrink .text instead.

For example, "size kernel/mutex.o" reports

	2715       0      12    2727     aa7 kernel/mutex.o

with __mutex_lock_common() uninlined, we have

	1565       0      12    1577     629 kernel/mutex.o

the difference is more than K.

Oleg.


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

* Re: [PATCH 2/2] __down_common: use signal_pending_state()
  2008-06-04 18:08   ` Oleg Nesterov
@ 2008-06-04 19:54     ` Matthew Wilcox
  0 siblings, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2008-06-04 19:54 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Ingo Molnar, Dmitry Adamushko, Peter Zijlstra,
	Roland McGrath, linux-kernel

On Wed, Jun 04, 2008 at 10:08:58PM +0400, Oleg Nesterov wrote:
> Actually, I don't understand why __down_common/__mutex_lock_common are inlines,
> perhaps it is better to shrink .text instead.

I believe Ingo did extensive benchmarking to determine that the current
situation with mutex_lock_common is the best one.  I didn't, I assumed
that following Ingo's lead would be the best idea.

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

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

* Re: [PATCH 2/2] __down_common: use signal_pending_state()
  2008-06-04 17:36 ` Matthew Wilcox
  2008-06-04 18:08   ` Oleg Nesterov
@ 2008-06-09 13:20   ` Ingo Molnar
  1 sibling, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2008-06-09 13:20 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Oleg Nesterov, Andrew Morton, Dmitry Adamushko, Peter Zijlstra,
	Roland McGrath, linux-kernel


* Matthew Wilcox <matthew@wil.cx> wrote:

> On Wed, Jun 04, 2008 at 09:09:06PM +0400, Oleg Nesterov wrote:
> > Cleanup. __down_common() can use the new signal_pending_state() helper.
> 
> This is a bad optimisation.  __down_common gets inlined and the 
> constant 'state' versions are optimised away for the versions which 
> don't apply.
> 
> NAK this patch.

well but we had a schedule() bug around this whole topic of 
TASK_KILLABLE, so i'd say robustness trumps micro-optimizations. Is this 
really a big issue? The dual-ness of TASK_KILLABLE checks is a bit ugly, 
and it led to a bug as well.

	Ingo

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

end of thread, other threads:[~2008-06-09 13:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-04 17:09 [PATCH 2/2] __down_common: use signal_pending_state() Oleg Nesterov
2008-06-04 17:36 ` Matthew Wilcox
2008-06-04 18:08   ` Oleg Nesterov
2008-06-04 19:54     ` Matthew Wilcox
2008-06-09 13:20   ` Ingo Molnar

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