From owner-dev-commits-src-main@freebsd.org Fri Sep 10 05:30:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5723B67F0F7; Fri, 10 Sep 2021 05:30:02 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H5PZx61Ndz4tnv; Fri, 10 Sep 2021 05:30:01 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 18A5Tr7w096048 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 9 Sep 2021 22:29:53 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 18A5TrhW096047; Thu, 9 Sep 2021 22:29:53 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Thu, 9 Sep 2021 22:29:53 -0700 From: Gleb Smirnoff To: Mateusz Guzik , 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: References: <202108171959.17HJx2lL069856@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202108171959.17HJx2lL069856@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4H5PZx61Ndz4tnv X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2021 05:30:02 -0000 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> AuthorDate: 2021-08-17 18:04:31 +0000 M> Commit: Mateusz Guzik 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