Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp18837imm; Wed, 25 Jul 2018 21:33:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdXTF7Uj+YUXIN8MbeHuwBZst+GeLNON4nuC/aB7qu7xi0YEMp/3o1GtWz1f36rhWVC/QAJ X-Received: by 2002:a63:35c3:: with SMTP id c186-v6mr405893pga.217.1532579606874; Wed, 25 Jul 2018 21:33:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532579606; cv=none; d=google.com; s=arc-20160816; b=rfducQ4EqE59ZocCVV/qEMD73fO5Fgk5AHW3XEeSaPRgOATcDkLl2IUUHVkp6WqbNB flSQHmZV1sl/Pc9ypF+wO12GsmJtgyjiKwinO8F4j83LLfIFz8t+b0cmFwJdNJesoA9D X7bLGyfSX+aYLKniXZQTzwj4F84cUJrih9k9hzhH7ZgE3wEkHmXewmXoGfXix/1P23cc i9xN+mFAPWksC2mGQY0c9POWHP0GuZT0xqMgPYIgVuNPoxmI08mybGVGGzkJgx69S49H 7WhJzDfuGmIN981M9w21B85N3krlpz1OhWcspJWta2K1pv3GQTGThuVB9lpCQXesfjZU byxw== 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=OYYTzn/sJhjnMFgrq/WZN1+4PYIHpJ0Z0k8GyoolF30=; b=u+G/Ltkapn20PfarkunlSlwXRULbykt3czPMJJ6sHYv8FnFvz3Nx+hfMsBxSaTAvyd rtlW6XqXo8Xv+n61cpNAdZL/OvHZO8+TCV/5/YiwI97Lhl3hADjd78AtS18tuUQZHXuq BVsVGwjfS4VLpY1JFbmPJ7YTyIdDSPCDtcBJGyU9JyLyPDrzHNrg3MVyeihMuYmHfMPE 8QCigjeoMZTfBDfaXEhHVzxKWtM7AbMMSqSKVo8wGUfG66rGM65weInSAyPNM38whHgA b+EgMGALTUGSYiPuN1PGNRfShMlHfGcu9MaEBjD/YKgwZf74VG/0uLauL/a9q77oMG+k LVew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=suDRIFrr; 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 g68-v6si340004plb.22.2018.07.25.21.33.09; Wed, 25 Jul 2018 21:33:26 -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=suDRIFrr; 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 S1728693AbeGZFrB (ORCPT + 99 others); Thu, 26 Jul 2018 01:47:01 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:56097 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727798AbeGZFrB (ORCPT ); Thu, 26 Jul 2018 01:47:01 -0400 Received: by mail-it0-f67.google.com with SMTP id 16-v6so993655itl.5; Wed, 25 Jul 2018 21:32: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=OYYTzn/sJhjnMFgrq/WZN1+4PYIHpJ0Z0k8GyoolF30=; b=suDRIFrroqcdqvcKRAJHsoUWQa2/x5tFEr+84L5eIbZj/nq+Twp57gTWlXAyTozo5O n+3ZQF/QeFfMh9Ul819rHTUdAoQ+w6ejLoebypGsnSQyEJvkbfT8CYSHRYBffW4+je2j +0dEmMn3jKnzuUNxsTM7JHT+xAyUczqjepscRQ1bBNnDWyav3FYBuiEFeGkx7XDMFDmr 2wWTAQV3uwOd1aiYW2lbnSgvcxRvduwJINb77ZF3K36lHtnDHS+o+RMT0o1Xveygm++y LSN8wSPBTBgo25ZSP9ILCANYUeuBEFohJF3L9CNvWVLGu2ptbE5WaU0Aesk575Zwnb2E EnWQ== 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=OYYTzn/sJhjnMFgrq/WZN1+4PYIHpJ0Z0k8GyoolF30=; b=p0L69nfuNApNxNoULNTkCxqUK9Yc59DD3iF61b96XCY+2OV2GnICRulUyHSry0v3Rk rL9GymnOjKL3ScALgwAAs6RvOMos81nUHs7XijXZnB4RT6IIRvDWPEuLcLizF32QklMk F/L92kaFkSUrx/TFZNR3A8fNR+3ibAbv8ALahU5+cNXyZl1d0+HGBVwwG3wruThS6pXI uoHCjw3YvX1AmC+tWCj9IC58l3t7oAFrqBiGxGQ5FKvFXuKKJ+0dIPWd4VAeGs29DMDr b9x4qd9w+YpM/S1IH6Fgpk1uPbLXNlnkmVJW5bxvv4PGMk5bWwJOGRUClteRPF++forY p2Nw== X-Gm-Message-State: AOUpUlEliwvA/TTQUeVQO+DkjtUTGLti/nlZJKlK0dtq0+pwO9IWfmAS /lytupJ4XO9P1Yjor7KmSM+GPcA02OhwpdGO7G8= X-Received: by 2002:a24:5004:: with SMTP id m4-v6mr636140itb.38.1532579526248; Wed, 25 Jul 2018 21:32:06 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:7a47:0:0:0:0:0 with HTTP; Wed, 25 Jul 2018 21:31:25 -0700 (PDT) In-Reply-To: <70428ad9-5d59-faed-4384-36190939a19d@gmail.com> 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:31: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: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? I think changing all of them from the number of SKBs to the number of network segments would be better. Thanks Yafang