Skip to content

Commit

Permalink
netprio_cgroup: don't allocate prio table when a device is registered
Browse files Browse the repository at this point in the history
So we delay the allocation till the priority is set through cgroup,
and this makes skb_update_priority() faster when it's not set.

This also eliminates an off-by-one bug similar with the one fixed
in the previous patch.

Origionally-authored-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: "David S. Miller" <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Neil Horman authored and David S. Miller committed Feb 10, 2012
1 parent a87dfe1 commit f5c3820
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions net/core/netprio_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,19 +271,13 @@ static int netprio_device_event(struct notifier_block *unused,
{
struct net_device *dev = ptr;
struct netprio_map *old;
u32 max_len = atomic_read(&max_prioidx);

/*
* Note this is called with rtnl_lock held so we have update side
* protection on our rcu assignments
*/

switch (event) {

case NETDEV_REGISTER:
if (max_len)
extend_netdev_table(dev, max_len);
break;
case NETDEV_UNREGISTER:
old = rtnl_dereference(dev->priomap);
RCU_INIT_POINTER(dev->priomap, NULL);
Expand Down

0 comments on commit f5c3820

Please sign in to comment.