]> git.baikalelectronics.ru Git - kernel.git/commit
tipc: optimize function tipc_node_timeout()
authorTung Nguyen <tung.q.nguyen@dektech.com.au>
Thu, 28 Jun 2018 20:39:25 +0000 (22:39 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 30 Jun 2018 11:51:39 +0000 (20:51 +0900)
commit161ada32abe45034d3687d9fda556ab0dce20289
tree1fbcc95220f43043d7ccba43fda4fad012050a59
parent6c7ef5d6e169e5520688a1cc0740c5b0defb9df2
tipc: optimize function tipc_node_timeout()

In single-link usage, the function tipc_node_timeout() still iterates
over the whole link array to handle each link. Given that the maximum
number of bearers are 3, there are 2 redundant iterations with lock
grab/release. Since this function is executing very frequently it makes
sense to optimize it.

This commit adds conditional checking to exit from the loop if the
known number of configured links has already been accessed.

Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/node.c