[PATCH 0/2] improve multicast join group performance

From: Jonas Rebmann
Date: Mon Oct 07 2024 - 10:18:55 EST


This series seeks to improve performance on updating igmp group
memberships such as with IP_ADD_MEMBERSHIP or MCAST_JOIN_SOURCE_GROUP.

Our use case was to add 2000 multicast memberships on a TQMLS1046A which
took about 3.6 seconds for the membership additions alone. Our userspace
reproducer tool was instrumented to log runtimes of the individual
setsockopt invocations which clearly indicated quadratic complexity of
setting up the membership with regard to the total number of multicast
groups to be joined. We used perf to locate the hotspots and
subsequently optimized the most costly sections of code.

This series includes a patch to Linux igmp handling as well as a patch
to the DPAA/Freescale driver. With both patches applied, our memberships can
be set up in only about 87 miliseconds, which corresponds to a speedup
of around 40.

While we have acheived practically linear run-time complexity on the
kernel side, a small quadratic factor remains in parts of the freescale
driver code which we haven't yet optimized. We have by now payed little
attention to the optimization potential in dropping group memberships,
yet the dpaa patch applies to joining and leaving groups alike.

Overall, this patch series brings great improvements in use cases
involving large numbers of multicast groups, particularly when using the
fsl_dpa driver, without noteworthy drawbacks in other scenarios.

Signed-off-by: Jonas Rebmann <jre@xxxxxxxxxxxxxx>
---
Jonas Rebmann (2):
net: ipv4: igmp: optimize ____ip_mc_inc_group() using mc_hash
net: dpaa: use __dev_mc_sync in dpaa_set_rx_mode()

drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 20 +++++++++--
drivers/net/ethernet/freescale/fman/fman_dtsec.c | 1 -
drivers/net/ethernet/freescale/fman/fman_memac.c | 1 -
drivers/net/ethernet/freescale/fman/fman_tgec.c | 1 -
drivers/net/ethernet/freescale/fman/mac.c | 42 ------------------------
drivers/net/ethernet/freescale/fman/mac.h | 2 --
net/ipv4/igmp.c | 26 ++++++++++++---
7 files changed, 39 insertions(+), 54 deletions(-)
---
base-commit: 8b641b5e4c782464c8818a71b443eeef8984bf34
change-id: 20241007-igmp-speedup-2ca0c7b9189d

Best regards,
--
Jonas Rebmann <jre@xxxxxxxxxxxxxx>