]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit5c4b8ea1348493d202e8967892c5515daf6950f2
tree6313edda1c8e183fe94a4a6832c4129568baa659
parent43e7f90e6581bc9c753c5bbfa1ecb8b6d390a46c
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