[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B6FE9@saturn3.aculab.com>
Date: Tue, 11 Sep 2012 12:42:23 +0100
From: "David Laight" <David.Laight@...LAB.COM>
To: "Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
<davem@...emloft.net>, <nhorman@...driver.com>
Cc: <john.r.fastabend@...el.com>, <gaofeng@...fujitsu.com>,
<eric.dumazet@...il.com>, <mark.d.rustad@...el.com>,
<lizefan@...wei.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 2/2] netprio_cgroup: Optimize the priomap copy loop slightly
> - for (i = 0;
> - old_priomap && (i < old_priomap->priomap_len);
> - i++)
> - new_priomap->priomap[i] = old_priomap->priomap[i];
> + if (old_priomap) {
> + old_len = old_priomap->priomap_len;
> +
> + for (i = 0; i < old_len; i++)
> + new_priomap->priomap[i] = old_priomap->priomap[i];
> + }
Or:
memcpy(new_priomap->priomap, old_priomap->priomap,
old_priomap->priomap_len * sizeof old_priomap->priomap[0]);
David
Powered by blists - more mailing lists