Re: dsa_master_find_slave()'s time complexity and potential performance hit

2021-03-02 Thread Vladimir Oltean
On Tue, Mar 02, 2021 at 01:51:42PM +0800, DENG Qingfang wrote: > 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 freque

dsa_master_find_slave()'s time complexity and potential performance hit

2021-03-02 Thread DENG Qingfang
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