Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3241087imu; Wed, 7 Nov 2018 07:18:42 -0800 (PST) X-Google-Smtp-Source: AJdET5d9rp1NA2b/LD2Oh01xMuI2rPkf5ga8Oh0iqSyDwwRUfLc9Aoc9Jqav7RJC1ic6aZxx2Z6m X-Received: by 2002:a63:a064:: with SMTP id u36mr522185pgn.145.1541603922058; Wed, 07 Nov 2018 07:18:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541603922; cv=none; d=google.com; s=arc-20160816; b=RUl5sB980LuDYsn9RyP+sAdhXpqtN2I8FaM+ecwuxbpxbCxm5Tjle2NWhI0pWNfe6m L6V8ZQ84rfZu6Jn+BHlYMGjKy5LRPZ7dqaF52nR794QV79sB1jcDGmJHvUd4CMgnhEiR 5IglO8KDNkrt1920j9XYd6LLejGD70hbmp1EMcGNhnvJykXVtVFuiLCmZvkrWEjTFN3A hBU83Z6lf2QN61w9H6p7nujdTI/Z9LRmrgB/X8t+HC0+WrYcvbQlY1NSqv+7f3PINW21 Z6wS++p5TfuraUoVgdi/lJtOhmszuHy7WuoUG5JnPgyIghFDM/xJPZxkcYv9QiSpLLaQ DvyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=s3uQNLZ0xnXl8aHoNxOz/s0JQbfR9Ehd2ASnbJ1VF0Q=; b=F6Xl33Ws9Ldb5yF5G2Sr5lrcS0Enro3uWC5rSbs7Nt6Mf+YXk66hCKH3xJ5VHjI2jr g3rndmMZ/NTlhHtSYRFuw37vn66vODFV/cd8v2LkjAk2Mkpw/P3ikVjNP5sIrLcz504W I7A351vnL5RisYv41XbIM0oea/Dl1cUoAW/L8x2MKiNX5aQKzqYOqt4N1h49mf7XSr4J 8zxJiB0Zem+p4znHxkvIbDbW0f2wJUEq2GSvMnTNo3QCkSyowq9znQ0R5kEtv326KSSO Rer8DgHUHNpHPgB3YmgRblYihpV/WiQjOq2dyY/lOCQMkPZ2C+ruHT+7B7K6Ob9KJQmG AeZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ENYXm2rW; 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 cf14-v6si889629plb.422.2018.11.07.07.18.26; Wed, 07 Nov 2018 07:18:42 -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=ENYXm2rW; 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 S1728058AbeKHArI (ORCPT + 99 others); Wed, 7 Nov 2018 19:47:08 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:37205 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726670AbeKHArI (ORCPT ); Wed, 7 Nov 2018 19:47:08 -0500 Received: by mail-pg1-f194.google.com with SMTP id c10-v6so7445877pgq.4; Wed, 07 Nov 2018 07:16:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=s3uQNLZ0xnXl8aHoNxOz/s0JQbfR9Ehd2ASnbJ1VF0Q=; b=ENYXm2rWOWTSdV3CIfo1EuhzzEREub2s7M+wYx9HXMihpf1Phut1+p8muL6w3p0jKo 8gMQGJsWawX6HVbIUMUoetiV9UXsEtYJTLEt6Ay9Eh4tPL+hcwBEdr2aAx83TWuPpKrd +TZ+0oOfmjUfqCCaFZaiJTLBsDj0851F4O7Hfutoma8Scym/tIgB9+WAcSt6W6XKKcpa wrK2mAUQlu1D3Eg4sZ//Sz3U/+j1MF2jHdXYMVz8M9qVeOg47JvPqt28VLRJDsLSsem6 SB+4QhANYPs7Dx9wQ9T0hDKwt4qEJtugc+zSNo63rK9Dm7iMEKgDPVzL2uFGhl54UWga n9sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=s3uQNLZ0xnXl8aHoNxOz/s0JQbfR9Ehd2ASnbJ1VF0Q=; b=lHwgCb7CgLXP4kqDzG7JhhoSQYBFe8Gd0rNZp5dFOsR9k9RdfLSSOvHgrRiKo6+ixV 2se1n+ELieZmlGBQqavcbrS+XmYGT3t9HWerDGioAWVcdR4FxvjCJbv7+GJl6ZGnb8yM Pvh+OpB6G5gj7IJLB2ezmzY8J956d6gU+Y2GrM3KmM2NJJgoalZfIBa7j1qIaZjiwB2H Xm8c7MDknYmM4PSOjkLBjQnFIKEuC/ytpqT4K/5BA6/HPW6mHzmD2wfmV0Ot9/ycniD4 zEhyPn+u2huSJL7tdj8HxJBsWxJPpuX/AMRALIDsnrgCwt8qTUHmvnj6C0H1ENBjfLKX q21w== X-Gm-Message-State: AGRZ1gKj3pV48NA571Y12fvosXMYLZ8Uf4XVEyNH/+2wZ1jnrWzemDf6 yamD8GoP0CH2MGvbRInqqx0= X-Received: by 2002:a63:c0f:: with SMTP id b15mr525573pgl.314.1541603780431; Wed, 07 Nov 2018 07:16:20 -0800 (PST) Received: from [192.168.86.235] (c-67-180-167-114.hsd1.ca.comcast.net. [67.180.167.114]) by smtp.gmail.com with ESMTPSA id e65-v6sm1067595pfa.90.2018.11.07.07.16.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 07:16:19 -0800 (PST) Subject: Re: [PATCH net-next] tcp: minor optimization in tcp ack fast path processing To: Yafang Shao , davem@davemloft.net, edumazet@google.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Joe Perches References: <1541589617-1607-1-git-send-email-laoar.shao@gmail.com> <1541589617-1607-2-git-send-email-laoar.shao@gmail.com> From: Eric Dumazet Message-ID: <560b2828-cb1b-5ab5-f98b-b042a7e483f8@gmail.com> Date: Wed, 7 Nov 2018 07:16:18 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1541589617-1607-2-git-send-email-laoar.shao@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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) {