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 --
| Steven Rostedt | Re: Major regression on hackbench with SLUB |
| Jeremy Fitzhardinge | [PATCH 02 of 36] x86: add memory clobber to save/loadsegment |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Paul Jackson | Re: cpuset-remove-sched-domain-hooks-from-cpusets |
git: | |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Arjan van de Ven | Re: [GIT]: Networking |
| Gerrit Renker | [PATCH 03/37] dccp: List management for new feature negotiation |
| Jarek Poplawski | [PATCH iproute2] Re: HTB accuracy for high speed |
