netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* dsa_master_find_slave()'s time complexity and potential performance hit
@ 2021-03-02  5:51 DENG Qingfang
  2021-03-02 11:28 ` Vladimir Oltean
  0 siblings, 1 reply; 2+ messages in thread
From: DENG Qingfang @ 2021-03-02  5:51 UTC (permalink / raw)
  To: netdev, Andrew Lunn, Jakub Kicinski, David Miller,
	Florian Fainelli, Vivien Didelot, Vladimir Oltean, linux-kernel,
	Russell King - ARM Linux admin
  Cc: Birger Koblitz, Bjørn Mork, Stijn Segers

Since commit 7b9a2f4bac68 ("net: dsa: use ports list to find slave"),
dsa_master_find_slave() has been iterating over a linked list instead
of accessing arrays, making its time complexity O(n).
The said function is called frequently in DSA RX path, so it may cause
a performance hit, especially for switches that have many ports (20+)
such as RTL8380/8390/9300 (There is a downstream DSA driver for it,
see https://github.com/openwrt/openwrt/tree/openwrt-21.02/target/linux/realtek/files-5.4/drivers/net/dsa/rtl83xx).
I don't have one of those switches, so I can't test if the performance
impact is huge or not.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-03  4:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02  5:51 dsa_master_find_slave()'s time complexity and potential performance hit DENG Qingfang
2021-03-02 11:28 ` Vladimir Oltean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).