Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp25658imm; Wed, 25 Jul 2018 21:44:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeiwgxnvzCl3ZpUUlLei2HVHq2pRGPHydnmr0gf6yhVjyj6r+gDyvQX8UKrbLWvGLMLriUe X-Received: by 2002:a17:902:a60b:: with SMTP id u11-v6mr476539plq.158.1532580258026; Wed, 25 Jul 2018 21:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532580258; cv=none; d=google.com; s=arc-20160816; b=QvX0y5agEx9p981qapsvN2/s5oJj7zWi0n7fwwuGjp/E2Bmjuxn0V+tGEDzo18WwkV qIWptLuYMHy2iHQ88DlHyGhxJ4gAqUFkH0i2yuJL7d6i9DP9RAnQUi7bi0uhVQxqoRuq pEuu6Ze6p0ZJ4UwG4plmNdRJrOqBOo29GTW0laMD6cQoMS/do8wmN/W1uUrnH/zKp8lf Ks6+9zgUGpMTs/3htCJCRo+jGoJmILLdz6oIMW0DGemi2g9xcMOTxGOdXMn0VHxwidfB gmxX8fKc9ar0kb/gEjI0f/Gcrg8lndWjps92rnSZ5Oa5EMXfriJl8RaT6vSwZX1qKtKC Zp8A== 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=uKm24KZzs7qXHcrqGjf4E/n9HyAp/3jp8FAVHLQPIqo=; b=tTv4Xg3QQnGs1wLO7OgKO6A+IIgXXcOa/O7KuZ2xo0JlvOZ5pEqJ8WrT9bKyXPTsMX EifzyYrrGjmkHPP62Hcf59eFlKegg/s/7G+ubUsln2FSQB1x+erLuesYexX3arVI9iTa AHX7MkGlOsp3kbYUC00bS4qAqRktp3PRzA9/7iheQ4YSOwrJ1Cj8Fu/d8AnK543xNYdV VvyIZDcPIOXJbmp76nw8r1gePyuispxMCqp0C2kUJOAupdC/GWwxHibK4iKZ24MmcyKq d0jVhn05mLIeSANm9tEFaqH1n6I3eO/9hMaOu0/rZ9852MWJ8E47YJh4mgJQ66jU9Sgd AP8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=in5tpqPO; 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 b76-v6si418856pfl.223.2018.07.25.21.44.03; Wed, 25 Jul 2018 21:44:17 -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=in5tpqPO; 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 S1728808AbeGZF6D (ORCPT + 99 others); Thu, 26 Jul 2018 01:58:03 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:51922 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726600AbeGZF6C (ORCPT ); Thu, 26 Jul 2018 01:58:02 -0400 Received: by mail-it0-f67.google.com with SMTP id e14-v6so1051058itf.1; Wed, 25 Jul 2018 21:43:06 -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=uKm24KZzs7qXHcrqGjf4E/n9HyAp/3jp8FAVHLQPIqo=; b=in5tpqPO3WD3gct2AYVMPOO29JR1esYBcf8ENkcWbhw643UjaCm163/t/dVqEv3apO /G0wwzcN5Dr1qhoC7hUtKCmbSbb/aZq+e1ViC7hPsFF5VbVU2iAf4WfVs0cKTK8Fs1Dy jSzRx1WbFC6FOE14x1sYYwYTDQPPbYkZwEUxyxuDrQf0YSvyLA+nuZo1VI8aB2XDmdPg xtz4pTXXbRVRbB7QuV4em/KJAsDmjmVoOiqotePL7btzwYqOvaCo0RPQYSvexEGa2WLk UFiAJjXx1EHOdlFYSwQQAkQcOJE8uAuB8jgUp+5RFq9QBqkY5Nzcb5TBj+YF1LHeeBtv NaXg== 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=uKm24KZzs7qXHcrqGjf4E/n9HyAp/3jp8FAVHLQPIqo=; b=rZXxMCcNyxcJ0O4NaxKmd94+FhsXhN0Y1cilcVgntYWlePvd+489hGU4lx2OTyYQMc RrnsK6XyO963F6Vo2b77QJUxzvUMxKZSEktvQ7icgSdG1Apm/RrPhXQEYoz5erIUStS9 XD3GMIKxQlq8w8apgVIFHgMb+t4UuF1QJ4eUCtip75d5gIOOqWWokh7V0r1dML3TsnsS ZV3Ya411Qc/PJBBr++gkqWHDDj6V8MHspFX770qcFe5grB0Y5jn0xtqxYk0cnzRTL2IF aJLiHvRTHcObMS65KMLHX9KN+jplMvGgT5ESF//FUG6J5z5kM9I2lTZ6I5NWMFb1PYHD hQ4Q== X-Gm-Message-State: AOUpUlHv+wOBE/2y6x5++ksSCNpAOYDqZpxs8Jdnj/b3lU92i0v5apMG FbbWBSd/RHS0qhdxJeP/RVLXbHZe2GdKHJu8eos= X-Received: by 2002:a24:af5d:: with SMTP id l29-v6mr642070iti.142.1532580186077; Wed, 25 Jul 2018 21:43:06 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:7a47:0:0:0:0:0 with HTTP; Wed, 25 Jul 2018 21:42:25 -0700 (PDT) In-Reply-To: References: <1532524010-11855-1-git-send-email-laoar.shao@gmail.com> <047bc12f-9eb5-e512-10c5-6334c494c77e@gmail.com> <096a8a2f-ea32-2107-b2af-c246450cc3b9@gmail.com> <70428ad9-5d59-faed-4384-36190939a19d@gmail.com> From: Yafang Shao Date: Thu, 26 Jul 2018 12:42:25 +0800 Message-ID: Subject: Re: [PATCH net-next] tcp: add SNMP counter for the number of packets pruned from ofo queue To: Eric Dumazet Cc: David Miller , Eric Dumazet , 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 Thu, Jul 26, 2018 at 12:36 PM, Eric Dumazet wrote: > > > On 07/25/2018 09:31 PM, Yafang Shao wrote: >> On Thu, Jul 26, 2018 at 12:06 PM, Eric Dumazet wrote: >>> >>> >>> On 07/25/2018 06:42 PM, Yafang Shao wrote: >>> >>>> >>>> Hi Eric, >>>> >>>> LINUX_MIB_TCPOFOQUEUE, LINUX_MIB_TCPOFODROP and LINUX_MIB_TCPOFOMERGE >>>> are all for the number of SKBs, but only LINUX_MIB_OFOPRUNED is for >>>> the event, that could lead misunderstading. >>>> So I think introducing a counter for the number of SKB pruned could be >>>> better, that could help us to track the whole behavior of ofo queue. >>>> That is why I submit this patch. >>> >>> Sure, and I said your patch had issues. >>> You mixed 'packets' and 'skbs' but apparently you do not get my point. >>> >> >> I had noticed that I made this mistake. >> >>> I would rather not add another SNMP counter, and refine the current one, >>> trying to track something more meaningful. >>> >>> The notion of 'skb' is internal to the kernel, and can not be mapped easily >>> to 'number of network segments' which probably is more useful for the user. >>> >>> I will send this instead : >>> >>> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c >>> index d51fa358b2b196d0f9c258b24354813f2128a675..141a062abd0660c8f6d049de1dc7c7ecf7a7230d 100644 >>> --- a/net/ipv4/tcp_input.c >>> +++ b/net/ipv4/tcp_input.c >>> @@ -5001,18 +5001,19 @@ static bool tcp_prune_ofo_queue(struct sock *sk) >>> { >>> struct tcp_sock *tp = tcp_sk(sk); >>> struct rb_node *node, *prev; >>> + unsigned int segs = 0; >>> int goal; >>> >>> if (RB_EMPTY_ROOT(&tp->out_of_order_queue)) >>> return false; >>> >>> - NET_INC_STATS(sock_net(sk), LINUX_MIB_OFOPRUNED); >>> goal = sk->sk_rcvbuf >> 3; >>> node = &tp->ooo_last_skb->rbnode; >>> do { >>> prev = rb_prev(node); >>> rb_erase(node, &tp->out_of_order_queue); >>> goal -= rb_to_skb(node)->truesize; >>> + segs += max_t(u16, 1, skb_shinfo(rb_to_skb(node))->gso_segs); >>> tcp_drop(sk, rb_to_skb(node)); >>> if (!prev || goal <= 0) { >>> sk_mem_reclaim(sk); >>> @@ -5023,6 +5024,7 @@ static bool tcp_prune_ofo_queue(struct sock *sk) >>> } >>> node = prev; >>> } while (node); >>> + NET_ADD_STATS(sock_net(sk), LINUX_MIB_OFOPRUNED, segs); >>> tp->ooo_last_skb = rb_to_skb(prev); >>> >>> /* Reset SACK state. A conforming SACK implementation will >>> >> >> You patch will make it more meaningful. >> How about the other ones? > > Same thing really. > > Note that tcp_collapse() does not currently propagate skb_shinfo(skb)->gso_segs > when rebuilding the skbs, so this will need a fix. > Got it. Thank you very much for your comment. Thanks Yafang