Re: [patch 1/3] LatencyTOP infrastructure patch

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Arjan van de Ven <arjan@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Linus Torvalds <torvalds@...>, Ingo Molnar <mingo@...>, Andrew Morton <akpm@...>
Date: Sunday, January 20, 2008 - 12:47 pm

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:


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).



for (i = 0; i < LT_SAVECOUNT; i++) {


-- 
Best regards,
Dmitry Adamushko
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[Announce] Development release 0.1 of the LatencyTOP tool, Arjan van de Ven, (Fri Jan 18, 1:36 pm)
Re: Development release 0.1 of the LatencyTOP tool, KOSAKI Motohiro, (Sun Jan 20, 8:52 pm)
Re: [Announce] Development release 0.1 of the LatencyTOP tool, Arjan van de Ven, (Sat Jan 19, 1:16 am)
Re: [Announce] Development release 0.1 of the LatencyTOP tool, Arjan van de Ven, (Sat Jan 19, 1:25 am)
Re: [Announce] Development release 0.1 of the LatencyTOP tool, Arjan van de Ven, (Sat Jan 19, 1:34 am)
Re: [Announce] Development release 0.1 of the LatencyTOP tool, Arjan van de Ven, (Fri Jan 18, 2:35 pm)
[patch 3/3] LatencyTOP instrumentations part 2, Arjan van de Ven, (Fri Jan 18, 1:42 pm)
[patch 2/3] Latencytop instrumentations part 1, Arjan van de Ven, (Fri Jan 18, 1:40 pm)
Re: [patch 2/3] Latencytop instrumentations part 1, Frank Ch. Eigler, (Fri Jan 18, 6:26 pm)
Re: [patch 2/3] Latencytop instrumentations part 1, Arjan van de Ven, (Fri Jan 18, 6:33 pm)
Re: [patch 2/3] Latencytop instrumentations part 1, Frank Ch. Eigler, (Fri Jan 18, 7:11 pm)
Re: [patch 2/3] Latencytop instrumentations part 1, Arjan van de Ven, (Fri Jan 18, 7:20 pm)
Re: [patch 2/3] Latencytop instrumentations part 1, Arnaldo Carvalho de Melo, (Fri Jan 18, 6:47 pm)
[patch 1/3] LatencyTOP infrastructure patch, Arjan van de Ven, (Fri Jan 18, 1:39 pm)
Re: LatencyTOP infrastructure patch, KOSAKI Motohiro, (Mon Jan 21, 4:06 am)
Re: LatencyTOP infrastructure patch, Arjan van de Ven, (Mon Jan 21, 12:16 pm)
Re: [patch 1/3] LatencyTOP infrastructure patch, Dmitry Adamushko, (Sun Jan 20, 12:47 pm)
Re: [patch 1/3] LatencyTOP infrastructure patch, Dmitry Adamushko, (Sun Jan 20, 1:18 pm)