public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Nicolas Pitre <nico@cam.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Arjan van de Ven <arjan@infradead.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [patch 1/3] mutex subsystem: trylock
Date: Fri, 30 Dec 2005 13:05:11 +1100	[thread overview]
Message-ID: <43B495D7.8080503@yahoo.com.au> (raw)
In-Reply-To: <Pine.LNX.4.64.0512291148560.3309@localhost.localdomain>

Nicolas Pitre wrote:

> I provided you with the demonstration last week:
> 

I didn't really find it convincing.

> - the non SMP (ARM version < 6) is using xchg.
> 
> - xchg on ARM version < 6 is always faster and smaller than any 
>   preemption disable.
> 

Maybe true, but as I said, if you have preemption enabled, then there
are far more preempt_xxx operations in other places than semaphores,
which impact both size and speed.

> - xchg on ARM is the same size as the smallest solution you may think of
>   when preemption is disabled and never slower (prove me otherwise? if 
>   you wish).
> 

I was going from your numbers where you said it was IIRC a cycle faster.

> - all xchg based primitives are "generic" code already.
> 

And yet there is a need for architecture specific code. Also having
xchg and a cmpxchg variants mean that you have two different sets of
possible interleavings of instructions, and xchg has much more subtle
cases as you demonstrated.

> And I think you didn't look at the overall patch set before talking 
> about "lots of ugliness", did you?  The fact is that the code, 

Yes I did and I think it is more ugly than my proposal would be.

> especially the core code, is much cleaner now than it was when 
> everything was seemingly "generic" since the current work on 
> architecture abstractions still allows optimizations in a way that is so 
> much cleaner and controlled than what happened with the semaphore code, 
> and the debugging code can even take advantage of it without polluting 
> the core code.
> 
> It happens that i386, x86_64 and ARM (if v6 or above) currently have 
> their own tweaks to save space and/or cycles in a pretty strictly 
> defined way.  The effort is currently spent on making sure if other 
> architectures want to use one of their own tricks for those they can do 
> it without affecting the core code which remains 95% of the whole thing 
> (which is not the case for semaphores), and the currently provided 
> architecture specific versions are _never_ bigger nor slower than any 
> generic version would be.  Otherwise what would be the point?  
> 

I don't think size is a great argument, because the operations should
be out of line anyway to save icache (your numbers showed a pretty
large increase when they're inlined)

And as for speed, I'm not arguing that you can't save a couple of
cycles, but I'm weighing that against the maintainability of a generic
implementation which has definite advantages. Wheras I don't think you
could demonstrate any real speed improvement for saving a few cycles
from slightly faster semaphore operations on CONFIG_PREEMPT kernels?

If someone ever did find the need for an arch specific variant that
really offers advantages, then there is nothing to stop tha being
added.

-- 
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com 

  reply	other threads:[~2005-12-30  2:05 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-23 16:16 [patch 00/11] mutex subsystem, -V7 Ingo Molnar
2005-12-24  5:15 ` Nicolas Pitre
2005-12-24  5:23   ` Nicolas Pitre
2005-12-26 19:24 ` Nicolas Pitre
2005-12-26 19:25 ` [patch 1/3] mutex subsystem: trylock Nicolas Pitre
2005-12-27 11:51   ` Ingo Molnar
2005-12-27 20:47     ` Nicolas Pitre
2005-12-28  7:48       ` Ingo Molnar
2005-12-28  8:13         ` Ingo Molnar
2005-12-28 16:29           ` Nicolas Pitre
2005-12-28 17:09             ` Ingo Molnar
2005-12-27 12:05   ` Arjan van de Ven
2005-12-27 13:15     ` Ingo Molnar
2005-12-29  4:06       ` Nicolas Pitre
2005-12-29  8:33         ` Ingo Molnar
2005-12-29  9:01           ` Nick Piggin
2005-12-29 17:15             ` Nicolas Pitre
2005-12-30  2:05               ` Nick Piggin [this message]
2005-12-29 16:46           ` Nicolas Pitre
2005-12-29  3:22     ` Nicolas Pitre
2005-12-26 19:25 ` [patch 2/3] mutex subsystem: fastpath inlining Nicolas Pitre
2005-12-27 11:55   ` Ingo Molnar
2005-12-27 21:59     ` Nicolas Pitre
2005-12-28  7:41       ` Ingo Molnar
2005-12-29  2:53         ` Nicolas Pitre
2005-12-29  8:41           ` Ingo Molnar
2006-01-06 21:20             ` Nicolas Pitre
2005-12-26 19:26 ` [patch 3/3] mutex subsystem: inline mutex_is_locked() Nicolas Pitre
2005-12-27 11:37   ` Ingo Molnar

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=43B495D7.8080503@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nico@cam.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox