[ovs-dev] [PATCH 1/3] netdev-linux: Cache result in netdev_linux_miimon_run()

Ben Pfaff blp at nicira.com
Tue Jan 22 17:47:05 UTC 2013


On Mon, Jan 21, 2013 at 03:10:00PM +0900, Simon Horman wrote:
> In general the network devices don't change very often.
> By caching the lookup made by netdev_linux_miimon_run()
> calls to shash_add() and shash_destroy() destroy are avoided
> reducing the use of malloc(), free() and hash_bytes().
> 
> In my test environment this increased the rate at
> which packets could be received from ~23.3kpps to ~24.4kpps.
> 
> Signed-off-by: Simon Horman <horms at verge.net.au>

The comment on netdev_dev_get_devices() needs an update.

However the main problem I see with this is that
netdev_dev_get_devices() is supposed to return a different list on a
per-netdev_class basis, but this code maintains only a single static
list, which might be for any arbitrary netdev_class because of the
caching technique in use, so it's likely to randomly segfault if there's
more than one netdev_dev class around.

Another simple way to speed this up might be for
netdev_dev_get_devices() to just return the global netdev_dev_shash and
require the callers to skip netdev_devs that belong to others' classes.



More information about the dev mailing list