[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090428171444.GC27584@redhat.com>
Date: Tue, 28 Apr 2009 19:14:44 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Zhaolei <zhaolei@...fujitsu.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...e.hu>, Tom Zanussi <tzanussi@...il.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 4/4] tracing/workqueue: Add max execution time
mesurement for per worklet
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists