mirror of
https://github.com/joel16/android_kernel_sony_msm8994.git
synced 2024-11-27 14:11:04 +00:00
openvswitch: Use RCU callback when detaching netdevices.
Currently, each time a device is detached from an OVS datapath we call synchronize RCU before freeing associated data structures. However, if a bridge is deleted (which detaches all ports) when many devices are connected then there can be a long delay. This switches to use call_rcu() to group the cost together. Reported-by: Justin Pettit <jpettit@nicira.com> Signed-off-by: Jesse Gross <jesse@nicira.com>
This commit is contained in:
parent
39c7caebc9
commit
92eb1d4771
@ -114,6 +114,15 @@ error:
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
static void free_port_rcu(struct rcu_head *rcu)
|
||||
{
|
||||
struct netdev_vport *netdev_vport = container_of(rcu,
|
||||
struct netdev_vport, rcu);
|
||||
|
||||
dev_put(netdev_vport->dev);
|
||||
ovs_vport_free(vport_from_priv(netdev_vport));
|
||||
}
|
||||
|
||||
static void netdev_destroy(struct vport *vport)
|
||||
{
|
||||
struct netdev_vport *netdev_vport = netdev_vport_priv(vport);
|
||||
@ -122,10 +131,7 @@ static void netdev_destroy(struct vport *vport)
|
||||
netdev_rx_handler_unregister(netdev_vport->dev);
|
||||
dev_set_promiscuity(netdev_vport->dev, -1);
|
||||
|
||||
synchronize_rcu();
|
||||
|
||||
dev_put(netdev_vport->dev);
|
||||
ovs_vport_free(vport);
|
||||
call_rcu(&netdev_vport->rcu, free_port_rcu);
|
||||
}
|
||||
|
||||
const char *ovs_netdev_get_name(const struct vport *vport)
|
||||
|
@ -20,12 +20,15 @@
|
||||
#define VPORT_NETDEV_H 1
|
||||
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/rcupdate.h>
|
||||
|
||||
#include "vport.h"
|
||||
|
||||
struct vport *ovs_netdev_get_vport(struct net_device *dev);
|
||||
|
||||
struct netdev_vport {
|
||||
struct rcu_head rcu;
|
||||
|
||||
struct net_device *dev;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user