From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jiri Pirko <jpirko@redhat.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
shemminger@vyatta.com, kaber@trash.net
Subject: Re: [PATCH net-next-2.6] net: replace hooks in __netif_receive_skb
Date: Thu, 27 May 2010 16:17:46 +0200 [thread overview]
Message-ID: <1274969866.2523.22.camel@edumazet-laptop> (raw)
In-Reply-To: <20100527134935.GA6916@psychotron.lab.eng.brq.redhat.com>
Le jeudi 27 mai 2010 à 15:49 +0200, Jiri Pirko a écrit :
> +/**
> + * netdev_rx_handler_unregister - unregister receive handler
> + * @dev: device to unregister a handler from
> + * @rh: receive handler to unregister
> + *
> + * Unregister a receive hander from a device.
> + */
> +void netdev_rx_handler_unregister(struct net_device *dev,
> + struct netdev_rx_handler *rh)
> +{
> + struct netdev_rx_handler *rh1;
> +
> + spin_lock_bh(&dev->rx_handlers_lock);
> + list_for_each_entry(rh1, &dev->rx_handlers, list) {
> + if (rx_handlers_equal(rh, rh1)) {
> + list_del_rcu(&rh1->list);
> + synchronize_net();
> + kfree(rh1);
> + break;
> + }
> + }
> + spin_unlock_bh(&dev->rx_handlers_lock);
> +}
> +EXPORT_SYMBOL(netdev_rx_handler_unregister);
> +
Please dont synchronize_net(); inside the spin_lock_bh() section, at a
very minimum.
void netdev_rx_handler_unregister(struct net_device *dev,
struct netdev_rx_handler *rh)
{
struct netdev_rx_handler *rh1, *found = NULL;
spin_lock_bh(&dev->rx_handlers_lock);
list_for_each_entry(rh1, &dev->rx_handlers, list) {
if (rx_handlers_equal(rh, rh1)) {
list_del_rcu(&rh1->list);
found = rh1;
break;
}
}
spin_unlock_bh(&dev->rx_handlers_lock);
if (found) {
synchronize_net();
kfree(rh1);
}
}
This synchronize_net() proliferation makes me very nervous.
Am I the only one that think this thing is/should be avoided as much as
possible ?
Please dont use synchronize_net() but a call_rcu(), there is absolutely
no point making this thread waits 30 or 40 ms, there is no risk here.
Thanks
next prev parent reply other threads:[~2010-05-27 14:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-27 13:49 [PATCH net-next-2.6] net: replace hooks in __netif_receive_skb Jiri Pirko
2010-05-27 14:06 ` Patrick McHardy
2010-05-27 14:57 ` Jiri Pirko
2010-05-27 14:17 ` Eric Dumazet [this message]
2010-05-27 15:02 ` Jiri Pirko
2010-05-27 14:47 ` Stephen Hemminger
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=1274969866.2523.22.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=jpirko@redhat.com \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.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