Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34fe76ab authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net-sched-fast-stats'



Eric Dumazet says:

====================
net: sched: faster stats gathering

A while back, I sent one RFC patch using lockless stats gathering
on 64bit arches.

This patch series does it more cleanly, using a seqcount.

Since qdisc/class stats are written at dequeue() time,
we can ask the dequeue to change the seqcount, so that
stats readers can avoid taking the root qdisc lock,
and instead the typical read_seqcount_{begin|retry} guarded
loop.

This does not change fast path costs, as the seqcount
increments are not more expensive than the bit manipulation,
and allows readers to not freeze the fast path anymore.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 64151ae3 edb09eb1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ struct mystruct {
	...
};

Update statistics:
Update statistics, in dequeue() methods only, (while owning qdisc->running)
mystruct->tstats.packet++;
mystruct->qstats.backlog += skb->pkt_len;

+2 −0
Original line number Diff line number Diff line
@@ -4610,6 +4610,7 @@ static int bond_check_params(struct bond_params *params)
static struct lock_class_key bonding_netdev_xmit_lock_key;
static struct lock_class_key bonding_netdev_addr_lock_key;
static struct lock_class_key bonding_tx_busylock_key;
static struct lock_class_key bonding_qdisc_running_key;

static void bond_set_lockdep_class_one(struct net_device *dev,
				       struct netdev_queue *txq,
@@ -4625,6 +4626,7 @@ static void bond_set_lockdep_class(struct net_device *dev)
			  &bonding_netdev_addr_lock_key);
	netdev_for_each_tx_queue(dev, bond_set_lockdep_class_one, NULL);
	dev->qdisc_tx_busylock = &bonding_tx_busylock_key;
	dev->qdisc_running_key = &bonding_qdisc_running_key;
}

/* Called from registration process */
+3 −0
Original line number Diff line number Diff line
@@ -1313,9 +1313,12 @@ ppp_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats64)
}

static struct lock_class_key ppp_tx_busylock;
static struct lock_class_key ppp_qdisc_running_key;

static int ppp_dev_init(struct net_device *dev)
{
	dev->qdisc_tx_busylock = &ppp_tx_busylock;
	dev->qdisc_running_key = &ppp_qdisc_running_key;
	return 0;
}

+2 −0
Original line number Diff line number Diff line
@@ -1577,6 +1577,7 @@ static const struct team_option team_options[] = {
static struct lock_class_key team_netdev_xmit_lock_key;
static struct lock_class_key team_netdev_addr_lock_key;
static struct lock_class_key team_tx_busylock_key;
static struct lock_class_key team_qdisc_running_key;

static void team_set_lockdep_class_one(struct net_device *dev,
				       struct netdev_queue *txq,
@@ -1590,6 +1591,7 @@ static void team_set_lockdep_class(struct net_device *dev)
	lockdep_set_class(&dev->addr_list_lock, &team_netdev_addr_lock_key);
	netdev_for_each_tx_queue(dev, team_set_lockdep_class_one, NULL);
	dev->qdisc_tx_busylock = &team_tx_busylock_key;
	dev->qdisc_running_key = &team_qdisc_running_key;
}

static int team_init(struct net_device *dev)
+1 −0
Original line number Diff line number Diff line
@@ -1862,6 +1862,7 @@ struct net_device {
#endif
	struct phy_device	*phydev;
	struct lock_class_key	*qdisc_tx_busylock;
	struct lock_class_key	*qdisc_running_key;
	bool			proto_down;
};
#define to_net_dev(d) container_of(d, struct net_device, dev)
Loading