Re: dev_get_by_index is not hashed: O(n)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In article <3D6EBE50.3090209@candelatech.com> you wrote:
> What does it use?  And btw, I'd hash get-by-name too.

to get a list of interfaces it first tries to read with SIOCGIFCONF a list
of all interfaces in a single read into a buffer which has room for 30
entries (and increases the buffer *= 2 in case it was too small).

It also linearly reads proc/net/dev and merges the info from there into the
list of interfaces from above. Then it does a whole lot of ioctls on the
name of that interface to get protocol family dependend info. I think this
is the slowest thing.

the SIOCGIFCONF used to take a lot of time, cause the buffer was increasing
more slowly. Someone could try to use even more aggresive algo. or just use
a bigger start value. I havent benchmarked it, but I guess it it the getting
of all the protocol params which slows it.

Greetings
Bernd
y
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux