Netdev List
 help / color / mirror / Atom feed
From: Neil Horman <nhorman@tuxdriver.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH] drop_monitor: allow more events per second
Date: Thu, 19 Apr 2012 13:28:44 -0400	[thread overview]
Message-ID: <20120419172844.GC18339@neilslaptop.think-freely.org> (raw)
In-Reply-To: <1334855781.2395.203.camel@edumazet-glaptop>

On Thu, Apr 19, 2012 at 07:16:21PM +0200, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> It seems there is a logic error in trace_drop_common(), since we store
> only 64 drops, even if they are from same location.
> 
> This fix is a one liner, but we probably need more work to avoid useless
> atomic dec/inc
> 
> Now I can watch 1 Mpps drops through dropwatch...
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>
> ---
> Neil, it seems this code is not SMP/preempt safe. Worker can free our
> data under us, and genlmsg_new() can return NULL under stress.
> 
>  net/core/drop_monitor.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
> index 7f36b38..5c3c81a 100644
> --- a/net/core/drop_monitor.c
> +++ b/net/core/drop_monitor.c
> @@ -150,6 +150,7 @@ static void trace_drop_common(struct sk_buff *skb, void *location)
>  	for (i = 0; i < msg->entries; i++) {
>  		if (!memcmp(&location, msg->points[i].pc, sizeof(void *))) {
>  			msg->points[i].count++;
> +			atomic_inc(&data->dm_hit_count);
>  			goto out;
>  		}
>  	}
> 
> 
> 

I spent a good deal of time going through it to make sure it was preempt safe,
but its certainly possible that I missed something.  I'll look at it shortly.
Thanks for this update though

Acked-by: Neil Horman <nhorman@tuxdriver.com>

  reply	other threads:[~2012-04-19 17:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-19 17:16 [PATCH] drop_monitor: allow more events per second Eric Dumazet
2012-04-19 17:28 ` Neil Horman [this message]
2012-04-19 21:25   ` Eric Dumazet
2012-04-20 13:06     ` Neil Horman
2012-04-21 20:29 ` David Miller

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=20120419172844.GC18339@neilslaptop.think-freely.org \
    --to=nhorman@tuxdriver.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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