Mateusz,

On Tue, Aug 17, 2021 at 07:59:02PM +0000, Mateusz Guzik wrote:
M> The branch main has been updated by mjg:
M> 
M> URL: 
https://cgit.FreeBSD.org/src/commit/?id=5091ca26507b83ebd5ce677dd26bd10e4bad4153
M> 
M> commit 5091ca26507b83ebd5ce677dd26bd10e4bad4153
M> Author:     Mateusz Guzik <m...@freebsd.org>
M> AuthorDate: 2021-08-17 18:04:31 +0000
M> Commit:     Mateusz Guzik <m...@freebsd.org>
M> CommitDate: 2021-08-17 19:56:33 +0000
M> 
M>     pf: save on branching in the common case in pf_test
M>     
M>     Reviewed by:    kp
M>     Sponsored by:   Rubicon Communications, LLC ("Netgate")
M> ---
M>  sys/netpfil/pf/pf.c | 6 +++---
M>  1 file changed, 3 insertions(+), 3 deletions(-)
M> 
M> diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
M> index e2dd3eb7c0de..add76c7b98d4 100644
M> --- a/sys/netpfil/pf/pf.c
M> +++ b/sys/netpfil/pf/pf.c
M> @@ -6151,7 +6151,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct 
mbuf **m0, struct inpcb *
M>  
M>      PF_RULES_RLOCK();
M>  
M> -    if (ip_divert_ptr != NULL &&
M> +    if (__predict_false(ip_divert_ptr != NULL) &&

This is an optimization for a setup without divert(4) at cost of pessimization
for a setup with divert(4). IMHO, __predict_false() predicate should guard
against error paths and other unusual events, not favor one setup over other.

-- 
Gleb Smirnoff
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to