From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: Michel Lespinasse <walken@google.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>,
Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Ming Lei <tom.leiming@gmail.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: lock's trace events can improve mutex's performance in userspace?
Date: Thu, 08 Apr 2010 17:05:30 +0800 [thread overview]
Message-ID: <4BBD9C5A.90307@cn.fujitsu.com> (raw)
In-Reply-To: <n2k8d20b11a1004050214m529fa5e7ke31a2213728ea511@mail.gmail.com>
Hi Michel,
Michel Lespinasse wrote:
> Sorry for the late reply...
>
> One thing to consider in locking micro-benchmarks is that often, code
> changes that slow down parts of the contended code path where the lock
> is not held, will result in an increase of the reported
> micro-benchmark metric. This effect is particularly marked for
> micro-benchmarks that consist of multiple threads doing empty
> acquire/release loops.
>
> As a thought experiment, imagine what would happen if you added a
> one-millisecond sleep in the contended code path for mutex
> acquisition. Soon all but one of your benchmark threads would be
> sleeping, and the only non-sleeping thread would be able to spin on
> that lock/unlock loop with no contention, resulting in very nice
> results for the micro-benchmark. Remove the sleep and the lock/unlock
> threads will have to contend, resulting in lower reported performance
> metrics.
Great thanks for your valuable reply that makes we see the
issue more clearly.
I've do the test address your conjecture that add usleep(1) in mutex
acquisition path, the test result shows contention is reduced.
And i also do the test that does more work in mutex holding path, the
result shows optimization ratio is decreased.
Thanks,
Xiao
prev parent reply other threads:[~2010-04-08 9:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-11 9:43 lock's trace events can improve mutex's performance in userspace? Xiao Guangrong
2010-03-13 4:27 ` Hitoshi Mitake
2010-04-05 9:14 ` Michel Lespinasse
2010-04-08 9:05 ` Xiao Guangrong [this message]
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=4BBD9C5A.90307@cn.fujitsu.com \
--to=xiaoguangrong@cn.fujitsu.com \
--cc=fweisbec@gmail.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mitake@dcl.info.waseda.ac.jp \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tom.leiming@gmail.com \
--cc=walken@google.com \
/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