From: Oleg Nesterov <oleg@redhat.com>
To: Zhaolei <zhaolei@cn.fujitsu.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@elte.hu>,
Tom Zanussi <tzanussi@gmail.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/4] tracing/workqueue: Add max execution time mesurement for per worklet
Date: Tue, 28 Apr 2009 19:14:44 +0200 [thread overview]
Message-ID: <20090428171444.GC27584@redhat.com> (raw)
In-Reply-To: <49F6E10A.5050203@cn.fujitsu.com>
I have no idea how the code actually looks with these patches applied,
so please don't take my words seriously, but
On 04/28, Zhaolei wrote:
>
> @@ -24,6 +24,17 @@ struct workfunc_stats {
> /* Protected by cpu workqueue lock */
> unsigned int inserted;
> unsigned int executed;
> +
> + /*
> + * save latest work_struct's pointer to use as identifier in
> + * probe_worklet_complete, because we can't use work_struct->...
> + * after worklet got executed
> + */
> + void *work;
Do we really need it ?
> @@ -143,6 +154,8 @@ found_wq:
> list_for_each_entry(wfnode, &node->workfunclist, list)
> if (wfnode->func == work->func) {
> wfnode->executed++;
> + wfnode->start_time = trace_clock_global();
> + wfnode->work = work;
> goto found_wf;
> }
> pr_debug("trace_workqueue: worklet not found\n");
> @@ -153,6 +166,43 @@ end:
> spin_unlock_irqrestore(&workqueue_cpu_stat(cpu)->lock, flags);
> }
>
> +/* Complete of a work */
> +static void
> +probe_worklet_complete(struct task_struct *wq_thread, void *work)
> +{
> + int cpu = cpumask_first(&wq_thread->cpus_allowed);
> + struct cpu_workqueue_stats *node;
> + struct workfunc_stats *wfnode;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&workqueue_cpu_stat(cpu)->lock, flags);
> +
> + list_for_each_entry(node, &workqueue_cpu_stat(cpu)->list, list)
> + if (node->task == wq_thread)
> + goto found_wq;
> + pr_debug("trace_workqueue: workqueue not found\n");
> + goto end;
> +
> +found_wq:
> + list_for_each_entry(wfnode, &node->workfunclist, list) {
> + u64 executed_time;
> +
> + if (wfnode->work != work)
> + continue;
Perhaps we can add node->last_work (or whatever) instead? It should be
recorded by the "entry" handler. In this case probe_worklet_complete()
doesn't need to search for this work (and it doesn't need the argument).
We know that wfnode == node->last_work.
Oleg.
next prev parent reply other threads:[~2009-04-28 17:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-28 10:51 [PATCH 0/4] workqueue_trace: Add max execution time mesurement for per worklet Zhaolei
2009-04-28 10:52 ` [PATCH 1/4] tracing/workqueue: turn workfunc_stats::inserted into unsigned int Zhaolei
2009-04-28 10:53 ` [PATCH 2/4] tracing/workqueue: Avoid accessing task_struct's member variable in stat file read Zhaolei
2009-04-28 10:54 ` [PATCH 3/4] tracing/workqueue: Use list_for_each_entry instrad of list_for_each_entry_safe in probe_workqueue_destruction() Zhaolei
2009-04-28 10:57 ` [PATCH 4/4] tracing/workqueue: Add max execution time mesurement for per worklet Zhaolei
2009-04-28 17:14 ` Oleg Nesterov [this message]
2009-04-30 1:15 ` Zhaolei
2009-04-28 21:53 ` [PATCH 0/4] workqueue_trace: " Frederic Weisbecker
2009-04-29 7:06 ` Andrew Morton
2009-04-29 13:33 ` Frederic Weisbecker
2009-04-29 13:43 ` Steven Rostedt
2009-04-29 13:45 ` Steven Rostedt
2009-04-29 15:36 ` Andrew Morton
2009-04-29 15:49 ` Frederic Weisbecker
2009-04-29 19:10 ` Ingo Molnar
2009-04-30 1:10 ` [PATCH 0/4] workqueue_trace: Add max execution time mesurementfor " Zhaolei
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=20090428171444.GC27584@redhat.com \
--to=oleg@redhat.com \
--cc=fweisbec@gmail.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=tzanussi@gmail.com \
--cc=zhaolei@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).