Date: Thu, 9 Sep 2021 22:29:53 -0700 From: Gleb Smirnoff <glebius@freebsd.org> To: Mateusz Guzik <mjg@freebsd.org>, kp@freebsd.org Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 5091ca26507b - main - pf: save on branching in the common case in pf_test Message-ID: <YTrtUWbpWxxzviSQ@FreeBSD.org> In-Reply-To: <202108171959.17HJx2lL069856@gitrepo.freebsd.org> References: <202108171959.17HJx2lL069856@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <mjg@FreeBSD.org> M> AuthorDate: 2021-08-17 18:04:31 +0000 M> Commit: Mateusz Guzik <mjg@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YTrtUWbpWxxzviSQ>