From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f42.google.com ([74.125.83.42]:42100 "EHLO mail-pg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753334AbeD3QBu (ORCPT ); Mon, 30 Apr 2018 12:01:50 -0400 Received: by mail-pg0-f42.google.com with SMTP id p9-v6so3686267pgc.9 for ; Mon, 30 Apr 2018 09:01:49 -0700 (PDT) Subject: Re: [PATCH V2 net-next 1/2] tcp: send in-queue bytes in cmsg upon read To: David Miller , eric.dumazet@gmail.com Cc: soheil.kdev@gmail.com, netdev@vger.kernel.org, ycheng@google.com, ncardwell@google.com, edumazet@google.com, willemb@google.com, soheil@google.com References: <20180427185733.36855-1-soheil.kdev@gmail.com> <20180430.113834.1760530542793231849.davem@davemloft.net> <20180430.115605.1094351453502803017.davem@davemloft.net> From: Eric Dumazet Message-ID: Date: Mon, 30 Apr 2018 09:01:47 -0700 MIME-Version: 1.0 In-Reply-To: <20180430.115605.1094351453502803017.davem@davemloft.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: On 04/30/2018 08:56 AM, David Miller wrote: > From: Eric Dumazet > Date: Mon, 30 Apr 2018 08:43:50 -0700 > >> I say sort of, because by the time we have any number, TCP might >> have received more packets anyway. > > That's fine. > > However, the number reported should have been true at least at some > finite point in time. > > If you allow overlapping changes to either of the two variables during > the sampling, then you are reporting a number which was never true at > any point in time. > > It is essentially garbage. Correct. TCP sockets are read by a single thread really (or synchronized threads), or garbage is ensured, regardless of how the kernel ensures locking while reporting "queue length"