From: Arjan van de Ven <arjan@infradead.org>
To: David Howells <dhowells@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>, lkml <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
Nicolas Pitre <nico@cam.org>,
Jes Sorensen <jes@trained-monkey.org>,
Al Viro <viro@ftp.linux.org.uk>, Oleg Nesterov <oleg@tv-sign.ru>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Christoph Hellwig <hch@infradead.org>, Andi Kleen <ak@suse.de>,
Russell King <rmk+lkml@arm.linux.org.uk>
Subject: Re: [patch 00/19] mutex subsystem, -V11
Date: Tue, 03 Jan 2006 16:14:45 +0100 [thread overview]
Message-ID: <1136301286.2869.2.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <16604.1136300837@warthog.cambridge.redhat.com>
On Tue, 2006-01-03 at 15:07 +0000, David Howells wrote:
> Ingo Molnar <mingo@elte.hu> wrote:
>
> > this is version -V11 of the generic mutex subsystem, against v2.6.15.
>
> When compiling for x86 with no mutex debugging, I see:
>
> (gdb) disas mutex_lock
> Dump of assembler code for function mutex_lock:
> 0xc02950d0 <mutex_lock+0>: lock decl (%eax)
> 0xc02950d3 <mutex_lock+3>: js 0xc02950ef <.text.lock.mutex>
> 0xc02950d5 <mutex_lock+5>: ret
> End of assembler dump.
> (gdb) disas 0xc02950ef
> Dump of assembler code for function .text.lock.mutex:
> 0xc02950ef <.text.lock.mutex+0>: call 0xc0294ffb <__mutex_lock_noinline>
> 0xc02950f4 <.text.lock.mutex+5>: jmp 0xc02950d5 <mutex_lock+5>
> 0xc02950f6 <.text.lock.mutex+7>: call 0xc029509f <__mutex_unlock_noinline>
> 0xc02950fb <.text.lock.mutex+12>: jmp 0xc02950db <mutex_unlock+5>
> End of assembler dump.
>
> Can you arrange .text.lock.mutex+0 here to just jump directly to
> __mutex_lock_noinline? Otherwise we have an unnecessarily extended return
> path.
jmp is free on x86. eg zero cycles. Any trickery is more likely to cost
because of doing unexpected things.
>
> You may not want to make the JS go directly there, but you could have that go
> to a JMP to __mutex_lock_noinline rather than having a CALL followed by a JMP
> back to a return instruction.
unbalanced call/ret pairs are REALLY expensive on x86. The current x86
processors all do branch prediction on the ret based on a special
internal call stack, breaking the symmetry is thus a branch prediction
miss, eg 40+ cycles
next prev parent reply other threads:[~2006-01-03 15:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-03 10:06 Ingo Molnar
2006-01-03 15:07 ` David Howells
2006-01-03 15:14 ` Arjan van de Ven [this message]
2006-01-05 13:44 ` David Howells
2006-01-05 16:48 ` Linus Torvalds
2006-01-03 15:55 ` David Howells
2006-01-03 15:58 ` Ingo Molnar
2006-01-03 16:16 ` [PATCH] Add synchronisation primitive testing module David Howells
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=1136301286.2869.2.camel@laptopd505.fenrus.org \
--to=arjan@infradead.org \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=dhowells@redhat.com \
--cc=hch@infradead.org \
--cc=jes@trained-monkey.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nico@cam.org \
--cc=oleg@tv-sign.ru \
--cc=rmk+lkml@arm.linux.org.uk \
--cc=torvalds@osdl.org \
--cc=viro@ftp.linux.org.uk \
/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
all inboxes | Powered by JetHome®