Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp778849imd; Sat, 3 Nov 2018 10:04:42 -0700 (PDT) X-Google-Smtp-Source: AJdET5cKHClUGcDXEqaHeLm1OA369nFm59gnOYd/ZgJiDocJYrkkS6BEshvBhawxtaZytq/afdFd X-Received: by 2002:a17:902:b598:: with SMTP id a24-v6mr7277106pls.231.1541264681958; Sat, 03 Nov 2018 10:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541264681; cv=none; d=google.com; s=arc-20160816; b=zbu5cm0i49NNXCjPiTTY65+gj25wfNgBO6WUYX6z660EgftZ4wUN6waGZj61vjMn7j MoOxaOYxhHiUcVrkZ0pKl0e5pMXFK+Nkh0t+InTnnGUizIvhI+jSx34EgjB7rl7LuPK/ cbaC5gv693OFF+AE5+j+JXWdJdvgs2qw/gObEj0k5GOoB6MPplK0kltHzmaFe+9ogZKJ nghrjtJKPNAkLaodUvaFEtM9psrP09BqYBQ7b2FVLul3M+gkSKmH+vOz/FF4bvzy2lt1 H6Qn3v68jHUxFXYesH+W0ttjaJLdCSWUQfmpwT5zqkZnJCI+E/OCwekAbl9h2F38DG1r KPnQ== 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:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=lSET3MNJUWxsCYOA/sJ0cIppU3Veh0Z14G99TSa1MKU=; b=VZQ2/Tf9ie8FySwQ9+Ir+RIiW1+nvoKhkp9z7kiFnRXJ9XJOHLMBk+uEolChbW2MEV r8Co5kAY4gSzi155KGd9KH0/1T0Nl+zmSLNGqZw+XTGWwQ0hM62KQVJAK80RelCoACOY f+/j0UkUZeu5KLbqS+eSNJxvm0xQskegvoEq3icmKxyJ8eO4Ojc6dIU8D+pQO6WczDwC ka+uZxfJFm17wytuE6QVfERgyVVIY8jG+Piuqc5oSAgd5Ha0oQk6ycnPpIG3xxVTsBKQ Vu4OUvyXIcqfSV/L4Z9C8eaneFkTno9d0pTnV85GMQVRuqy+hDXokpwKZzk1pSx9YrHO 0HTg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x16si3058594pga.407.2018.11.03.10.04.26; Sat, 03 Nov 2018 10:04:41 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727879AbeKDCP5 (ORCPT + 99 others); Sat, 3 Nov 2018 22:15:57 -0400 Received: from smtprelay0172.hostedemail.com ([216.40.44.172]:53648 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726849AbeKDCP5 (ORCPT ); Sat, 3 Nov 2018 22:15:57 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id 1A4C8100E86C2; Sat, 3 Nov 2018 17:04:06 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1540:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:2895:3138:3139:3140:3141:3142:3352:3622:3865:3867:3868:3870:3871:3872:4321:5007:10004:10400:10450:10455:10848:11026:11232:11473:11658:11914:12296:12438:12679:12740:12760:12895:13069:13311:13357:13439:14659:14721:19904:19999:21080:21627:30054:30070:30090:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.14.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:28,LUA_SUMMARY:none X-HE-Tag: move52_5dddede97f55d X-Filterd-Recvd-Size: 1737 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf11.hostedemail.com (Postfix) with ESMTPA; Sat, 3 Nov 2018 17:04:04 +0000 (UTC) Message-ID: <945a90d62aa45c4b53349ba0a104574759d40efe.camel@perches.com> Subject: Re: [PATCH] tcp: do not update snd_una if it is same with ack_seq From: Joe Perches To: Yafang Shao , davem@davemloft.net, edumazet@google.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sat, 03 Nov 2018 10:04:03 -0700 In-Reply-To: <1541264071-9905-1-git-send-email-laoar.shao@gmail.com> References: <1541264071-9905-1-git-send-email-laoar.shao@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.1-1build1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2018-11-04 at 00:54 +0800, Yafang Shao wrote: > In the slow path, TCP_SKB_SB(skb)->ack_seq may be same with tp->snd_una, > and under this condition we don't need to update the snd_una. > > Furthermore, tcp_ack_update_window() is only called in slow path, > so introducing this check won't affect the fast path processing. [] > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c [] > @@ -3610,7 +3611,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) { stylistic nit: While the precedence is correct in any case, perhaps adding parentheses around flag & FLAG_SND_UNA_ADVANCED would make it more obvious.