wireguard: send/receive: use explicit unlikely branch instead of implicit coalescing
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 6 May 2020 21:33:06 +0000 (15:33 -0600)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 May 2020 03:03:47 +0000 (20:03 -0700)
commit243f2148937adc72bcaaa590d482d599c936efde
tree6313edda1c8e183fe94a4a6832c4129568baa659
parent4fed818ef54b08d4b29200e416cce65546ad5312
wireguard: send/receive: use explicit unlikely branch instead of implicit coalescing

It's very unlikely that send will become true. It's nearly always false
between 0 and 120 seconds of a session, and in most cases becomes true
only between 120 and 121 seconds before becoming false again. So,
unlikely(send) is clearly the right option here.

What happened before was that we had this complex boolean expression
with multiple likely and unlikely clauses nested. Since this is
evaluated left-to-right anyway, the whole thing got converted to
unlikely. So, we can clean this up to better represent what's going on.

The generated code is the same.

Suggested-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wireguard/receive.c
drivers/net/wireguard/send.c