]> 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)
commit2b2111f6880dd5d53379cf8a2184377d597ac988
tree1fbcc95220f43043d7ccba43fda4fad012050a59
parent89ebf5484d8131acd57f84c659d56ede85fccd0f
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