diff options
author | Jonas Rebmann <jre@pengutronix.de> | 2024-10-07 16:17:11 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-10-09 12:50:11 +0100 |
commit | 69a3272d787c3e5977927a2775ecbd1a847dcf11 (patch) | |
tree | 6370d1326eb83da84d4c49f3d4d6357b9bbd025b /drivers/net/mdio/mdio-cavium.c | |
parent | 20503272422693d793b84f88bf23fe4e955d3a33 (diff) |
net: ipv4: igmp: optimize ____ip_mc_inc_group() using mc_hash
The runtime cost of joining a single multicast group in the current
implementation of ____ip_mc_inc_group grows linearly with the number of
existing memberships. This is caused by the linear search for an
existing group record in the multicast address list.
This linear complexity results in quadratic complexity when successively
adding memberships, which becomes a performance bottleneck when setting
up large numbers of multicast memberships.
If available, use the existing multicast hash map mc_hash to quickly
search for an existing group membership record. This leads to
near-constant complexity on the addition of a new multicast record,
significantly improving performance for workloads involving many
multicast memberships.
On profiling with a loopback device, this patch presented a speedup of
around 6 when successively setting up 2000 multicast groups using
setsockopt without measurable drawbacks on smaller numbers of
multicast groups.
Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/mdio/mdio-cavium.c')
0 files changed, 0 insertions, 0 deletions