From: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Paul Mackerras <paulus@samba.org>, Li Zefan <lizf@cn.fujitsu.com>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
Masami Hiramatsu <mhiramat@redhat.com>,
Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH 1/3] lockdep: Move lock events under lockdep recursion protection
Date: Tue, 09 Mar 2010 16:18:58 +0900 [thread overview]
Message-ID: <4B95F662.4090401@dcl.info.waseda.ac.jp> (raw)
In-Reply-To: <1267599302-2886-2-git-send-regression-fweisbec@gmail.com>
On 03/03/10 15:55, Frederic Weisbecker wrote:
> There are rcu locked read side areas in the path where we submit
> a trace event. And these rcu_read_(un)lock() trigger lock events,
> which create recursive events.
>
> One pair in do_perf_sw_event:
>
> __lock_acquire
> |
> |--96.11%-- lock_acquire
> | |
> | |--27.21%-- do_perf_sw_event
> | | perf_tp_event
> | | |
> | | |--49.62%-- ftrace_profile_lock_release
> | | | lock_release
> | | | |
> | | | |--33.85%-- _raw_spin_unlock
>
> Another pair in perf_output_begin/end:
>
> __lock_acquire
> |--23.40%-- perf_output_begin
> | | __perf_event_overflow
> | | perf_swevent_overflow
> | | perf_swevent_add
> | | perf_swevent_ctx_event
> | | do_perf_sw_event
> | | perf_tp_event
> | | |
> | | |--55.37%-- ftrace_profile_lock_acquire
> | | | lock_acquire
> | | | |
> | | | |--37.31%-- _raw_spin_lock
>
> The problem is not that much the trace recursion itself, as we have a
> recursion protection already (though it's always wasteful to recurse).
> But the trace events are outside the lockdep recursion protection, then
> each lockdep event triggers a lock trace, which will trigger two
> other lockdep events. Here the recursive lock trace event won't
> be taken because of the trace recursion, so the recursion stops there
> but lockdep will still analyse these new events:
>
> To sum up, for each lockdep events we have:
>
> lock_*()
> |
> trace lock_acquire
> |
> ----- rcu_read_lock()
> | |
> | lock_acquire()
> | |
> | trace_lock_acquire() (stopped)
> | |
> | lockdep analyze
> |
> ----- rcu_read_unlock()
> |
> lock_release
> |
> trace_lock_release() (stopped)
> |
> lockdep analyze
>
> And you can repeat the above two times as we have two rcu read side
> sections when we submit an event.
>
> This is fixed in this patch by moving the lock trace event under
> the lockdep recursion protection.
Thanks a lot, Frederic!
I tested perf lock with your patch, result is like this,
Typical scores:
before:
% sudo ./perf lock record ./perf bench sched messaging
# Running sched/messaging benchmark...
# 20 sender and receiver processes per group
# 10 groups == 400 processes run
Total time: 3.265 [sec]
[ perf record: Woken up 0 times to write data ]
[ perf record: Captured and wrote 143.952 MB perf.data (~6289344 samples) ]
after:
% sudo ./perf lock record ./perf bench sched messaging
# Running sched/messaging benchmark...
# 20 sender and receiver processes per group
# 10 groups == 400 processes run
Total time: 1.943 [sec] <--- about x1.5 faster!
[ perf record: Woken up 0 times to write data ]
[ perf record: Captured and wrote 98.161 MB perf.data (~4288734 samples)
] <--- size of perf.data is also reduced
next prev parent reply other threads:[~2010-03-09 7:19 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-03 6:54 [GIT PULL] perf updates Frederic Weisbecker
2010-03-03 6:55 ` [PATCH 1/3] lockdep: Move lock events under lockdep recursion protection Frederic Weisbecker
2010-03-09 7:18 ` Hitoshi Mitake [this message]
2010-03-10 0:10 ` Frederic Weisbecker
2010-03-09 8:34 ` Jens Axboe
2010-03-09 8:35 ` Jens Axboe
2010-03-10 0:05 ` Frederic Weisbecker
2010-03-10 15:45 ` Peter Zijlstra
2010-03-10 15:56 ` Jens Axboe
2010-03-10 15:55 ` Jens Axboe
2010-03-09 23:45 ` Frederic Weisbecker
2010-03-10 15:55 ` Jens Axboe
2010-03-03 6:55 ` [RFC][PATCH 2/3] perf: Take a hot regs snapshot for trace events Frederic Weisbecker
2010-03-03 8:38 ` Peter Zijlstra
2010-03-03 20:07 ` Frederic Weisbecker
2010-03-04 19:01 ` Frederic Weisbecker
2010-03-05 3:08 ` [PATCH 0/2] Perf " Frederic Weisbecker
2010-03-05 3:08 ` [PATCH 1/2] perf: Introduce new perf_save_regs() for hot regs snapshot Frederic Weisbecker
2010-03-05 15:08 ` Masami Hiramatsu
2010-03-05 16:38 ` Frederic Weisbecker
2010-03-05 17:08 ` Masami Hiramatsu
2010-03-05 17:17 ` Frederic Weisbecker
2010-03-05 20:55 ` [PATCH 1/2] perf: Introduce new perf_fetch_caller_regs() " Frederic Weisbecker
2010-03-05 20:55 ` [PATCH 2/2] perf: Take a hot regs snapshot for trace events Frederic Weisbecker
2010-03-05 3:08 ` Frederic Weisbecker
2010-03-03 16:06 ` [RFC][PATCH 2/3] " Steven Rostedt
2010-03-03 16:37 ` Peter Zijlstra
2010-03-03 17:07 ` Steven Rostedt
2010-03-03 17:16 ` Peter Zijlstra
2010-03-03 17:45 ` Steven Rostedt
2010-03-03 20:37 ` Frederic Weisbecker
2010-03-04 11:25 ` Ingo Molnar
2010-03-04 15:16 ` Steven Rostedt
2010-03-04 15:36 ` Ingo Molnar
2010-03-04 15:55 ` Steven Rostedt
2010-03-04 21:17 ` Ingo Molnar
2010-03-04 21:30 ` Steven Rostedt
2010-03-04 21:37 ` Frederic Weisbecker
2010-03-04 21:52 ` Thomas Gleixner
2010-03-04 22:01 ` Frederic Weisbecker
2010-03-04 22:02 ` Steven Rostedt
2010-03-04 22:09 ` Frederic Weisbecker
2010-03-03 6:55 ` [PATCH 3/3] perf/x86-64: Use frame pointer to walk on irq and process stacks Frederic Weisbecker
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=4B95F662.4090401@dcl.info.waseda.ac.jp \
--to=mitake@dcl.info.waseda.ac.jp \
--cc=acme@redhat.com \
--cc=fweisbec@gmail.com \
--cc=jens.axboe@oracle.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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
all inboxes | Powered by JetHome®