Created attachment 329396 [details] Improve performance with large numbers of interfaces Description of problem: The rename_device helper inefficiently scans sysfs for information about a given network device, which becomes very slow if the system has a large number of network devices (as would be the case on a system with many virtualized guests). The attached patch improves the performance by streamlining the process of getting interface information. Using a test of creating 1500 veth pairs (3000 devices total), the attached patch improves performance by 250% and significantly decreases the load on the system during the test. Tested on Fedora x86_64. rename_device.c | 92 +++++++++++--------------------------------------------- 1 file changed, 19 insertions(+), 73 deletions(-) Version-Release number of selected component (if applicable): The patch was generated and tested with initscripts-8.86. How reproducible: Always. Steps to Reproduce: 1. Write a script to generate 1500 veth devices 2. Measure time to run the script before and after the patch
There's an obvious bug/typo in your new asprintf call, but looks good otherwise. Added.
http://git.fedorahosted.org/git/?p=initscripts.git;a=commitdiff;h=eb1d89063ed017db9deed6fe7ed9e0beef77eb6b Will get to rawhide at some point.