summaryrefslogtreecommitdiff
path: root/net/core/netprio_cgroup.c
diff options
context:
space:
mode:
authorSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>2012-09-13 00:32:34 +0400
committerDavid S. Miller <davem@davemloft.net>2012-09-14 00:18:40 +0400
commitf05ba7fccf0c5f0422378adaffcb119d08b9f304 (patch)
tree504194829b96ad5f64c646dfc4b4336ee63550b1 /net/core/netprio_cgroup.c
parentd530d6df96ee28902486f8e11815ef9ad3a1cd1b (diff)
downloadlinux-f05ba7fccf0c5f0422378adaffcb119d08b9f304.tar.xz
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: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/netprio_cgroup.c')
-rw-r--r--net/core/netprio_cgroup.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
index fd339bb00106..45c503e45fc6 100644
--- a/net/core/netprio_cgroup.c
+++ b/net/core/netprio_cgroup.c
@@ -73,7 +73,6 @@ static int extend_netdev_table(struct net_device *dev, u32 new_len)
((sizeof(u32) * new_len));
struct netprio_map *new_priomap = kzalloc(new_size, GFP_KERNEL);
struct netprio_map *old_priomap;
- int i;
old_priomap = rtnl_dereference(dev->priomap);
@@ -82,10 +81,10 @@ static int extend_netdev_table(struct net_device *dev, u32 new_len)
return -ENOMEM;
}
- for (i = 0;
- old_priomap && (i < old_priomap->priomap_len);
- i++)
- new_priomap->priomap[i] = old_priomap->priomap[i];
+ if (old_priomap)
+ memcpy(new_priomap->priomap, old_priomap->priomap,
+ old_priomap->priomap_len *
+ sizeof(old_priomap->priomap[0]));
new_priomap->priomap_len = new_len;