Commit f05ba7fc authored by Srivatsa S. Bhat's avatar Srivatsa S. Bhat Committed by David S. Miller

netprio_cgroup: Use memcpy instead of the for-loop to copy priomap

Replace the current (inefficient) for-loop with memcpy, to copy priomap.
Signed-off-by: default avatarSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d530d6df
...@@ -73,7 +73,6 @@ static int extend_netdev_table(struct net_device *dev, u32 new_len) ...@@ -73,7 +73,6 @@ static int extend_netdev_table(struct net_device *dev, u32 new_len)
((sizeof(u32) * new_len)); ((sizeof(u32) * new_len));
struct netprio_map *new_priomap = kzalloc(new_size, GFP_KERNEL); struct netprio_map *new_priomap = kzalloc(new_size, GFP_KERNEL);
struct netprio_map *old_priomap; struct netprio_map *old_priomap;
int i;
old_priomap = rtnl_dereference(dev->priomap); old_priomap = rtnl_dereference(dev->priomap);
...@@ -82,10 +81,10 @@ static int extend_netdev_table(struct net_device *dev, u32 new_len) ...@@ -82,10 +81,10 @@ static int extend_netdev_table(struct net_device *dev, u32 new_len)
return -ENOMEM; return -ENOMEM;
} }
for (i = 0; if (old_priomap)
old_priomap && (i < old_priomap->priomap_len); memcpy(new_priomap->priomap, old_priomap->priomap,
i++) old_priomap->priomap_len *
new_priomap->priomap[i] = old_priomap->priomap[i]; sizeof(old_priomap->priomap[0]));
new_priomap->priomap_len = new_len; new_priomap->priomap_len = new_len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment