Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp302000imu; Wed, 7 Nov 2018 17:46:59 -0800 (PST) X-Google-Smtp-Source: AJdET5c3tFDdWbPcK5yYkmbBkC8SHOzZjEP/hzz4QhfETYfpSbDwHGVqB8iDrEXHPbJzWuGZo86y X-Received: by 2002:a17:902:4025:: with SMTP id b34-v6mr2692032pld.318.1541641619108; Wed, 07 Nov 2018 17:46:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541641619; cv=none; d=google.com; s=arc-20160816; b=fJbAEyxMonueT1zs3idXe+UPI/hgh4/bc2phbdLrB+wkonUB8IwZpYv0f8ojT39tmu 5oUdjuyQfvWRrpAIEzBmpCBCkn5TBUORIbxEWDudaQd7cvkhfdH2Iq77pE0efHd5sTTZ rioWuToc7mSYG8iYR0JRw2GhvuxvGu8R77p0chlP2McyTVQZCxtPC0XyZk1x49asCkvZ uq8byaA099eFW5tcBsdgU2N4PODlinGdACxe+fmIBO2f8uFHWie5/TN3o3NoQR4u10bD COlg3SN3edSalyxUnX7OdaZSIwrcXSJnHAnu/yHi/TWEoIAhLOzeJ+Y+Q/EihqbZjQpW cLuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=csWGnVVVFpNbuE1SB1MGKj094gsKUpU0jLP+zy5p7zw=; b=SayR3pG7PK9nbC43eUQrjAS+E7FDW6iNMhCasvd6hXt/n5lFU6cF3xuLzIPYYcngPQ CjQ36GRZhXe0onF2RUMJ6NahnCkxyboH/3qpB0+ZXRkapQyMCV+vSfZ6c5bRP4M6lKWA nzkaPJYxzQp8w0ncINdl6vxbGMEdBVVqmvTQykTZLVPrEU1g+1wC9Hc093GhrBwjiJPp iJgJkuX5yQKYRc63yjM79LHPqlXQZjKu0AqZXR9WaBgYCW+LhGVAR4t5ACLUC7fou6Mg 5b5a2oe27MeM5QwXEPgedNFnL8AQ92x7w2uTarbjNNPw5VDhXjswmDZVV18/EZwbEyeV OEEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fkx1rbZw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14-v6si2363590pgt.78.2018.11.07.17.46.43; Wed, 07 Nov 2018 17:46:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fkx1rbZw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728481AbeKHLTW (ORCPT + 99 others); Thu, 8 Nov 2018 06:19:22 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:35164 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728376AbeKHLTW (ORCPT ); Thu, 8 Nov 2018 06:19:22 -0500 Received: by mail-io1-f68.google.com with SMTP id 79-v6so13473897iou.2; Wed, 07 Nov 2018 17:46:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=csWGnVVVFpNbuE1SB1MGKj094gsKUpU0jLP+zy5p7zw=; b=fkx1rbZweWll96uCB6mGGxOqdVUG5AtfnoE/wsCP5HokL7wd8ExT/SruncBPXNwfit 8ZpDNEBP4aDFXqML5ID32AFAPfUqeUXmLcmj3dFM6Z+y2TJZWU+c2JkLOyFI02wzgcdB akatjC5JXBxtH95dqYWxRnx5APb+G1xmxm1sP6Uy8dCtKxxu2rdHBQjUNmZ2iEx6B/SF auCezzzqx6mhw0Bxop1ntQkgvE9RRKoiDsi8jg/93xg1ieV1UU5wr+vD63rRxeDQCGff Jh43Eig43oNbokrJUtw9T2Etip/AWLaJKRdtnfTDku6MS65AIAU7/PeKrWcYaXfB0nIm W6Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=csWGnVVVFpNbuE1SB1MGKj094gsKUpU0jLP+zy5p7zw=; b=Ejz3AJf2C8QxH0WUlI5kMTJbvZqgoyKStcSPJoA3Njrmoj8amQ9+ql9aMmAmoroVB5 oLUwn7U/tR+5rFfOAs6nGIlLuT8tcN6xujhFxXUlJghDAe+QxYtBT97NVkzOiXJbBzdE ElI1zX1FCZ9wYrtUVeDcHldT+Z49O+93EFHPRp/54PgqcxGOcK3Z2bUVdLL01b+af21J qdn7xA6ONDr/BMD4IhEfnhlduq6vR+/+aIVdNCpiDcWVgkzYFrf0BOpesSE7BDBhRvy0 d+iSY8kuq9Cnfmma+uCMKMhgEkJVcIRufi4UB7Y4mvqaDNm+yz9/On6NF8OIMsVMGKdH v2cQ== X-Gm-Message-State: AGRZ1gJ0q8VUF9nFDKdAQBgFe5X87w6vozD3zONSy5bbsFQNjmLYp44q 4nbe4G6O/WHJPYWrPLZt0/sHN/5O701ZyUIE5do= X-Received: by 2002:a6b:9046:: with SMTP id s67-v6mr2064167iod.295.1541641578473; Wed, 07 Nov 2018 17:46:18 -0800 (PST) MIME-Version: 1.0 References: <1541589617-1607-1-git-send-email-laoar.shao@gmail.com> <1541589617-1607-2-git-send-email-laoar.shao@gmail.com> <560b2828-cb1b-5ab5-f98b-b042a7e483f8@gmail.com> In-Reply-To: <560b2828-cb1b-5ab5-f98b-b042a7e483f8@gmail.com> From: Yafang Shao Date: Thu, 8 Nov 2018 09:45:42 +0800 Message-ID: Subject: Re: [PATCH net-next] tcp: minor optimization in tcp ack fast path processing To: Eric Dumazet Cc: David Miller , Eric Dumazet , netdev , LKML , Joe Perches Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 7, 2018 at 11:16 PM Eric Dumazet wrote: > > > > 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) { > That's better. Will change it. Thanks Yafang