From: Eric Dumazet <eric.dumazet@gmail.com>
To: Tom Herbert <therbert@google.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH] Fix locking in flush_backlog
Date: Tue, 23 Mar 2010 17:14:04 +0100 [thread overview]
Message-ID: <1269360844.2983.294.camel@edumazet-laptop> (raw)
In-Reply-To: <65634d661003230856v3d1737dehf64a883c1e785333@mail.gmail.com>
Le mardi 23 mars 2010 à 08:56 -0700, Tom Herbert a écrit :
> Eric,
>
> I'm not sure what you're asking. Do you just want to add spinlocks in
> the flush_backlog function without changing the mechanism to call the
> function on each CPU, or keep flush_backlog but call it from
> netdev_run_todo for each queue?
>
keep flush_backlog() so that its role is obvious and indentation level
not too big.
static void flush_backlog(int cpu)
{
struct softnet_data *queue = &per_cpu(softnet_data, cpu);
struct sk_buff *skb, *tmp;
unsigned long flags;
spin_lock_irqsave(&queue->input_pkt_queue.lock, flags);
skb_queue_walk_safe(&queue->input_pkt_queue, skb, tmp)
if (skb->dev == dev) {
__skb_unlink(skb, &queue->input_pkt_queue);
kfree_skb(skb);
}
spin_unlock_irqrestore(&queue->input_pkt_queue.lock, flags);
}
And call it from netdev_run_todo() :
for_each_online_cpu(i)
flush_backlog(i);
This adds two lines to netdev_run_todo() only.
Thanks
prev parent reply other threads:[~2010-03-23 16:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-23 6:04 [PATCH] Fix locking in flush_backlog Tom Herbert
2010-03-23 6:29 ` Eric Dumazet
2010-03-23 15:56 ` Tom Herbert
2010-03-23 16:14 ` Eric Dumazet [this message]
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=1269360844.2983.294.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.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