lkml.org 
[lkml]   [2009]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: spin_is_locked() broken for uniprocessor?
From
Hello,

On Wed, Aug 19, 2009 at 12:53 PM, Alan Cox<alan@lxorguk.ukuu.org.uk> wrote:
> On Wed, 19 Aug 2009 10:38:06 +0100
>
> in drivers because there is driver code that uses spin_is_locked() in
> fairly sensible fashion when dealing with locking.
>
One use is to measure lock contention hits on a particular spin lock.


However I wonder if there are tracing capabilities to measure lock
contention on a particular lock?

Currently I have inserted code much like this to get a feeling on the
contention:

this_cpu = get_cpu();
put_cpu();
contention = spin_is_locked(&lock);
spin_lock*(&lock);
if (contention) {
/* spin lock was contended, prev_cpu, this_cpu */
/* no hard guarantee, as we had a possible race inbetween
is_locked() and lock(), but works for driver/irq spin lock */
}

/* critical section */

prev_cpu = this_cpu;
spin_unlock*(&lock);

Regards,
--
Leon


\
 
 \ /
  Last update: 2009-08-19 13:19    [W:0.059 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site