Re: [PATCH][RFC] Measuring term of acquiring spinlock

From: Frederic Weisbecker
Date: Fri Nov 13 2009 - 05:51:32 EST


On Fri, Nov 13, 2009 at 01:21:25PM +0900, Hitoshi Mitake wrote:
> > Might make sense to put it into 'perf lock' kind of tool. I think
> > Frederic had such plans.
>
> If you want a tester for 'perf lock', please call me, Frederic :)


Thanks :)
I haven't started it yet, because of some other things I need to finish.

Would you be interested in starting it?

The lock tracepoints are:

- lock_acquire: the lock is requested but not yet "acquired"
- lock_release
- lock_contended: we can't get the lock yet because someone already
holds it.
- lock_acquired: we got the lock


So, the point would be to develop a state machine that is
able to give us statistics on a per lock granularity
basis:


- the total/average/maximum time a lock is contended,
waited before being acquired (probably
lock_acquired time - lock_acquire time)

- the ratio of contention versus immediate availability
=> Sequence acquire - acquired means immediate
availability. If we have a contended event inside
it means it had to wait because of the contention.

- the total/average/maximum time a lock is held.
It would be very nice to also add an option to see the
callsites sorted from max to min, if possible with a per
boundary granularity: the couple (lock callsite, unlock callsite),
still on a per lock basis.

- any idea you could have...


Such a tool would be very useful to profile the kernel locking.

It would be nice to use design close to what perf sched does:
having an lock event structure that provides callbacks for each
lock events so that we can easily plug various plugin inside.

It's just a suggestion in case you are interested and have time
for that. Otherwise I'll do it later.

Hm?

Thanks,
Frederic.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/