public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Shawn Bohrer <sbohrer@rgmadvisors.com>
Cc: Rick Jones <rick.jones2@hp.com>, netdev@vger.kernel.org
Subject: Re: Understanding lock contention in __udp4_lib_mcast_deliver
Date: Tue, 02 Jul 2013 13:16:38 -0700	[thread overview]
Message-ID: <1372796198.4979.20.camel@edumazet-glaptop> (raw)
In-Reply-To: <20130627224444.GE5936@sbohrermbp13-local.rgmadvisors.com>

On Thu, 2013-06-27 at 17:44 -0500, Shawn Bohrer wrote:
> On Thu, Jun 27, 2013 at 03:03:15PM -0700, Rick Jones wrote:
> > 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.
> 
> Yep, so ~1% of my total time is in _raw_spin_lock and using perf
> annotate it appears that maybe only 5-6% percent of that is actually
> contention and the rest is acquire/release.  Looks like I need to look
> elsewhere for my performance improvements.  Thanks Rick for your help!
> Below is the output of perf annotate if your curious.

It seems multicast reception could benefit from the 'hcount' infra added
in commit fdcc8aa953a1123 ("udp: add a counter into udp_hslot")

That is : if udp hash slot has few sockets (apparently in your case, at
most one socket per hash slot), we can perform RCU lookup as in unicast
case.

__udp4_lib_mcast_deliver() had to use a spin_lock() protection because
we had no idea of the number of sockets we could find, as we use a
stack[256 / sizeof(struct sock *)] to hold socket pointers, and one
incoming message had to be delivered exactly once per socket.

  reply	other threads:[~2013-07-02 20:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-27 19:22 Understanding lock contention in __udp4_lib_mcast_deliver Shawn Bohrer
2013-06-27 19:58 ` Rick Jones
2013-06-27 20:20   ` Shawn Bohrer
2013-06-27 20:46     ` Rick Jones
2013-06-27 21:54       ` Shawn Bohrer
2013-06-27 22:03         ` Rick Jones
2013-06-27 22:44           ` Shawn Bohrer
2013-07-02 20:16             ` Eric Dumazet [this message]
2013-06-27 21:39 ` Or Gerlitz
2013-06-27 21:58   ` Shawn Bohrer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1372796198.4979.20.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=rick.jones2@hp.com \
    --cc=sbohrer@rgmadvisors.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox