Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3568213imm; Sun, 29 Jul 2018 22:41:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcquJBprEP7Yqq1sKser25rYwOasdtNMaNGcQUknSGx/6I4ays/KICQqa+j0j+aQLwiGPZm X-Received: by 2002:a63:e206:: with SMTP id q6-v6mr15169712pgh.223.1532929319346; Sun, 29 Jul 2018 22:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532929319; cv=none; d=google.com; s=arc-20160816; b=uW3J0Ig0Ps2S7TYk5mnHjrpB37Eor9FidC/bp1aPxZQUWiv47ysjqF38tTlDsJbbJr hR+vt7k1FSkhuHjWdwukl308FhNIvaOcIW2gw3aeaXoLsv3laeuqYnf3QsQevDE+BabB /iP2qO2h+6EOmM9tdfHre0M55Qlon9qsknuE+QFynAsgvJJuLja7UTPH5Cf98f8yoHp5 6tkdAmplM6CDTmq2xLl0i4nLyJROotc1oh8J/R9s8OW73lOum2R7kFM29JhWKtWMdvh0 hvqCkK0aAuPaT92wMMD3jyYXdzXVnMxiH6Wafh6qzTjpONTPo0DqO2mSiJwrHLkOblUS 5Mlw== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=neKSnuwzeNEdwsrSZJGDCj6ofbCwbLiLY7jas/NJWKY=; b=DXOCfea4v8EoFGoYrE6dFsEiF8gU7MifCR8vetSjIOn264LqhHxkGY5on29N0Q6a+H qMlkrII4ItCOZMXRAX5m4nvx6e44NLz2iY2X2beaaEeRHRIr+DWZU42v9TUexgToG3rB TPHyNTtzFHhcMWmQsrk1CfFrPZKesOCHnNmsHHofm4hQ/nbQDIS/pgAv4mo6KCitJY8a wmnJ6ja/ijM7kwtcnrINeSxxDC+At3sDgBlavM4ICn2uP0fNy+ap8BPgSN0VmvLt9Tt2 cs/1CqtdUbpDwS5RwWll4P3QqfVt78+S3LikBOOmOe0gQEhxR9XsA6EdjKPcGbAWeVxR JNvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kUdec97G; 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 j24-v6si9140196pgj.145.2018.07.29.22.41.42; Sun, 29 Jul 2018 22:41:59 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kUdec97G; 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 S1726469AbeG3HOI (ORCPT + 99 others); Mon, 30 Jul 2018 03:14:08 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:52760 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726208AbeG3HOI (ORCPT ); Mon, 30 Jul 2018 03:14:08 -0400 Received: by mail-it0-f68.google.com with SMTP id d9-v6so15398801itf.2; Sun, 29 Jul 2018 22:40:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=neKSnuwzeNEdwsrSZJGDCj6ofbCwbLiLY7jas/NJWKY=; b=kUdec97G0ARS+LZ5PQpwaSY/gIyEws0fQ1gCw8zt8DRGlAk2KzZKod9ZwSCRh/royI hidluESWJH5pZTp9mXa+sZemsaj8c8u8Ly1gwjO/iy+upxYtVgihnsxmH0ejDzo4dH6Y 9mS5C4UnDeknTKsbO7Kl9+qUaKVpOqgJZTDWwOZh9j1YScghTHIE6WRSBCwb+lSfdSFX vLXUg6NAthBumK8/+GYTY3Ka4GnVyEhJ7KfAHZtUcq01AOlJayQmwMYmCIzoP/zeM8Ol UK50DpbTYMY76VSMalu7WaLFJpoNXTtNteY/KCBI5pINPWWbZEDbnrZpSHp5arm6I0Tw YPvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=neKSnuwzeNEdwsrSZJGDCj6ofbCwbLiLY7jas/NJWKY=; b=uARwwXdrYNugBpJgb/9LFBXPXOLeifeg53quyuhcR6ON5i5qFTW0tvUTSI4r37IMRn /HBRi2tkkEfUGL9BtZ2SL/f5C15uz3Ybf0wQaJCmZhFOnjW/Qz3WAgCujUVz1Qh622zC x5H3D0eCo0NgP8DyJ+qiTmgp0ZMQ2FTOvdGm3iU6bx7CH8b8H7bBPgq0CE8+gwiCWahk 2GcdrCIBV0pu+byUuI1QydeBsL5oUI4+BZiPMi4TDXywCKpjIQ1V2DGb2UJiv9QRvjcO JTwTJKp7R1JY9PW5KF98tjhJi3NZQRv0OHksZfA8D68F8hcf9E12xOKxFddR8LJOn3wc 00PA== X-Gm-Message-State: AOUpUlGYaFXJCX/DPNKlG5WxsMJCF21XvbIlV9+WGYDcuMtuO9G/++DV uQIkhmn2dD0K3JiTTRmNQ4jQU693HEsrp7fFf5Y= X-Received: by 2002:a24:af5d:: with SMTP id l29-v6mr13113047iti.142.1532929251633; Sun, 29 Jul 2018 22:40:51 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:7a47:0:0:0:0:0 with HTTP; Sun, 29 Jul 2018 22:40:11 -0700 (PDT) In-Reply-To: References: <1532746900-11710-1-git-send-email-laoar.shao@gmail.com> From: Yafang Shao Date: Mon, 30 Jul 2018 13:40:11 +0800 Message-ID: Subject: Re: [PATCH net-next 1/2] tcp: call tcp_drop() in tcp collapse To: Eric Dumazet Cc: David Miller , netdev , LKML 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 Mon, Jul 30, 2018 at 10:27 AM, Eric Dumazet wrote: > On Sun, Jul 29, 2018 at 7:06 PM Yafang Shao wrote: >> >> On Sun, Jul 29, 2018 at 12:28 AM, Eric Dumazet wrote: >> > On Sat, Jul 28, 2018 at 12:43 AM Yafang Shao wrote: >> >> >> >> On Sat, Jul 28, 2018 at 11:38 AM, Eric Dumazet wrote: >> >> > On Fri, Jul 27, 2018 at 8:35 PM Yafang Shao wrote: >> >> > >> >> >> So what about LINUX_MIB_TCPOFOMERGE ? >> >> >> Regarding LINUX_MIB_TCPOFOMERGE, a skb is already covered by another >> >> >> skb, is that dropping the packet or simply lowering the memory >> >> >> overhead ? >> >> > >> >> > What do you think ? >> >> > >> >> > If you receive two times the same payload, don't you have to drop one >> >> > of the duplicate ? >> >> > >> >> > There is a a big difference between the two cases. >> >> >> >> If the drop caused some data lost (which may then cause retransmition >> >> or something), then this is a really DROP. >> >> While if the drop won't cause any data lost, meaning it is a >> >> non-harmful behavior, I think it should not be defined as DROP. >> >> This is my suggestion anyway. >> > >> > Sigh. >> > >> > We count drops, not because they are ' bad or something went wrong'. >> > >> > If TCP stack receives twice the same sequence (same payload), we >> > _drop_ one of the duplicate, so we account for this event. >> > >> > When ' collapsing' we reorganize our own storage, not because we have >> > to drop a payload, >> > but for some memory pressure reason. >> >> Thanks for you clarification. >> So what about LINUX_MIB_TCPOFODROP ? >> >> if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) { >> NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP); >> tcp_drop(sk, skb); >> return; >> } >> >> >> It is also because of our own memory pressure, but we call tcp_drop() here. > > Yes, we _drop_ a packet. > > That is pretty clear that the payload is dropped, and that the sender > will have to _retransmit_. > >> >> I am not mean to disagree with you. I am just confused and want to >> make it clear. > > > Collapsing is : > > For (a bunch of packets) > Try (to compress them in order to reduce memory overhead) > > No drop of payload happens here. Sender wont have to retransmit. OK. Thanks for your patient. Should we put NET_INC_STATS(sock_net(sk), mib_idx) into the funtion tcp_drop() ? Then we could easily relate the sk_drops with the SNMP counters. Something like that, static void tcp_drop(struct sock *sk, struct sk_buff *skb, int mib_idx) { int segs = max_t(u16, 1, skb_shinfo(skb)->gso_segs); atomic_add(segs, &sk->sk_drops); NET_ADD_STATS(sock_net(sk), mib_idx, segs); __kfree_skb(skb); } Thanks Yafang