From: "Dmitry Adamushko" <dmitry.adamushko@gmail.com>
To: "Arjan van de Ven" <arjan@linux.intel.com>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Linus Torvalds" <torvalds@linux-foundation.org>,
"Ingo Molnar" <mingo@elte.hu>,
"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: [patch 1/3] LatencyTOP infrastructure patch
Date: Sun, 20 Jan 2008 17:47:31 +0100 [thread overview]
Message-ID: <b647ffbd0801200847k76b3cf2en5b6b9e169d6aefe4@mail.gmail.com> (raw)
In-Reply-To: <20080118093943.0048d0f7@laptopd505.fenrus.org>
Hello Arjan,
a few comments on the current locking scheme.
There is a single global lock and the locked section in
account_scheduler_latency() seems to be quite long:
(at worst case)
- get_wchan() ;
- account_global_scheduler_latency() which does up to MAXLR (128)
loops x2 strcmp() operations;
- up to LT_SAVECOUNT (32) x2 strcmp() operations by
account_scheduler_latency() itself.
That may induce a high latency for paths which call set_latency_reason_*().
Looking at the code, it looks like what really needs to be protected
is 'task->latency_reason'.
task->latency_record[] and a global latency_record[] are printed out
without any synchronization with account_scheduler_latency(). Is it
your intention?
That can be ok if we want to trade some preciseness for lower lock-contention.
If so,
- account_scheduler_latency() might take a snapshot of
'tsk->latency_reason' with the 'latency_lock' being held and do the
rest in a lock-less way.
Note, we have only a single writer to 'tsk->latency_record[]' at any
time due to the rq->lock to which 'tsk' belongs to being held ;
- yeah, this way the global 'latency_record[]' needs some sort of
protection as we may have concurrent writers here.
what do you think?
and a few minor comments below:
> +void __sched account_scheduler_latency(struct task_struct *tsk,
> + int usecs, int inter)
> +{
>
> [ ... ]
>
> + spin_lock_irqsave(&latency_lock, flags);
> + if (!tsk->latency_reason.reason) {
> + static char str[KSYM_NAME_LEN];
> + unsigned long EIPV = get_wchan(tsk);
> + sprint_symbol(str, EIPV);
> + tsk->latency_reason.reason = "Unknown reason";
> + strncpy(tsk->latency_reason.argument, str, 23);
> + }
> +
provided we hit a number of consequent "latencies" with explicitly
unspecified 'tsk->latency_reason', they all end up recorded in a
single 'tsk->latency_record' with "Unknown reason" and the _same_
'argument' which is the result of get_wchan() for the very _first_
"latency" in a row.
I think, it would make sense to record them separately with their
respective get_wchan() (so that they still could be identified).
> --- linux-2.6.24-rc7.orig/fs/proc/base.c
> +++ linux-2.6.24-rc7/fs/proc/base.c
> @@ -310,6 +310,60 @@ static int proc_pid_schedstat(struct tas
> }
> #endif
>
> +#ifdef CONFIG_LATENCYTOP
> +static int lstats_show_proc(struct seq_file *m, void *v)
> +{
> + int i;
> + struct task_struct *task = m->private;
> + seq_puts(m, "Latency Top version : v0.1\n");
> +
> + for (i = 0; i < 32; i++) {
> + if (task->latency_record[i].reason)
for (i = 0; i < LT_SAVECOUNT; i++) {
--
Best regards,
Dmitry Adamushko
next prev parent reply other threads:[~2008-01-20 16:47 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-18 17:36 [Announce] Development release 0.1 of the LatencyTOP tool Arjan van de Ven
2008-01-18 17:39 ` [patch 1/3] LatencyTOP infrastructure patch Arjan van de Ven
2008-01-20 11:34 ` Helge Deller
2008-01-20 16:47 ` Dmitry Adamushko [this message]
2008-01-20 17:18 ` Dmitry Adamushko
2008-01-21 8:06 ` KOSAKI Motohiro
2008-01-21 16:16 ` Arjan van de Ven
2008-01-18 17:40 ` [patch 2/3] Latencytop instrumentations part 1 Arjan van de Ven
2008-01-18 22:26 ` Frank Ch. Eigler
2008-01-18 22:33 ` Arjan van de Ven
2008-01-18 22:47 ` Arnaldo Carvalho de Melo
2008-01-18 23:11 ` Frank Ch. Eigler
2008-01-18 23:20 ` Arjan van de Ven
2008-01-18 17:42 ` [patch 3/3] LatencyTOP instrumentations part 2 Arjan van de Ven
2008-01-18 18:27 ` [Announce] Development release 0.1 of the LatencyTOP tool Roberto Fichera
2008-01-18 18:35 ` Arjan van de Ven
2008-01-18 18:46 ` Roberto Fichera
2008-01-18 19:02 ` Zan Lynx
2008-01-19 5:07 ` Andi Kleen
2008-01-19 5:16 ` Arjan van de Ven
2008-01-19 5:27 ` Andi Kleen
2008-01-19 5:25 ` Arjan van de Ven
2008-01-19 5:33 ` Andi Kleen
2008-01-19 5:34 ` Arjan van de Ven
2008-01-19 6:08 ` Andi Kleen
2008-01-19 5:37 ` [Announce] Development release 0.1 of the LatencyTOP tool II Andi Kleen
2008-01-21 0:52 ` Development release 0.1 of the LatencyTOP tool KOSAKI Motohiro
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=b647ffbd0801200847k76b3cf2en5b6b9e169d6aefe4@mail.gmail.com \
--to=dmitry.adamushko@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arjan@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.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
Powered by JetHome