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)
commit759f29b62fb9af5274e7f761f9f4cdfa7bb5a1f2
tree1fbcc95220f43043d7ccba43fda4fad012050a59
parentef9be755697f1b841c2a219a05df1a72ccd6f471
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