Subject: Re: Understanding lock contention in __udp4_lib_mcast_deliver

From: Rick Jones <[email-masked]>
Date: Thu, 27 Jun 2013 15:03:15 -0700

On 06/27/2013 02:54 PM, Shawn Bohrer wrote:
> On Thu, Jun 27, 2013 at 01:46:58PM -0700, Rick Jones wrote:
>> How do you know that time is actually contention and not simply
>> acquire and release overhead?
>
> Excellent point, and that could be the problem with my thinking.  I
> just now tried (unsuccessfully) to use lockstat to see if there was
> any contention reported.  I read Documentation/lockstat.txt and
> followed the instructions but the lock in question did not appear to
> be in the output.  I think I'm going to have to go with the assumption
> that this is just acquire and release overhead.

I think there is a way to get perf to "annotate" (iirc that is the term 
it uses) the report to show hits at the instruction level.  Ostensibly 
one could then look and see how many of the hits were for the 
acquire/release part of the routine, and how much was for the actual 
contention.

Another way to go, perhaps, would be to break-out the "contention" 
portion into a separate routine.  Then the question of contention versus 
acquire/release would be clearly answered in a profile without needing 
to take the annotation path.  Long ago and far away in IA64 land that 
was done.  An example can be seen in:

ftp://ftp.netperf.org/iptable_scaling/full_iptables/32_core_net_next_full_iptables_cycles.txt

where you will see "ia64_spinlock_contention" rather high in the 
profile. (That was taken with HP's "caliper" tool, when perfmon was the 
mechanism in use for accessing performance counters)

rick jones