From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH net-next] tcp: minor optimization in tcp ack fast path processing Date: Wed, 7 Nov 2018 07:16:18 -0800 Message-ID: <560b2828-cb1b-5ab5-f98b-b042a7e483f8@gmail.com> References: <1541589617-1607-1-git-send-email-laoar.shao@gmail.com> <1541589617-1607-2-git-send-email-laoar.shao@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Joe Perches To: Yafang Shao , davem@davemloft.net, edumazet@google.com Return-path: In-Reply-To: <1541589617-1607-2-git-send-email-laoar.shao@gmail.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On 11/07/2018 03:20 AM, Yafang Shao wrote: > Bitwise operation is a little faster. > So I replace after() with (flag & FLAG_SND_UNA_ADVANCED) as this flag is > already set before. > > Cc: Joe Perches > Signed-off-by: Yafang Shao > --- > net/ipv4/tcp_input.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c > index 2868ef2..0167015 100644 > --- a/net/ipv4/tcp_input.c > +++ b/net/ipv4/tcp_input.c > @@ -3610,7 +3610,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) > if (flag & FLAG_UPDATE_TS_RECENT) > tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq); > > - if (!(flag & FLAG_SLOWPATH) && after(ack, prior_snd_una)) { > + if (!(flag & FLAG_SLOWPATH) && (flag & FLAG_SND_UNA_ADVANCED)) { > /* Window is constant, pure forward advance. > * No more checks are required. > * Note, we use the fact that SND.UNA>=SND.WL2. > What about reducing this to a single conditional jump ? if ((flag & (FLAG_SLOWPATH | FLAG_SND_UNA_ADVANCED)) == FLAG_SND_UNA_ADVANCED) {