Received: by 10.192.165.156 with SMTP id m28csp817354imm; Tue, 17 Apr 2018 21:44:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx48V0kofpVi1cH5gNd+owLzPaH7ysKK5+X8nr8nS5tO7yf8Z5rtHX4Vo5rbQedvgCkDx1FmY X-Received: by 10.99.42.206 with SMTP id q197mr541811pgq.60.1524026673134; Tue, 17 Apr 2018 21:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524026673; cv=none; d=google.com; s=arc-20160816; b=WmwT6hptImwa8Li2OFUJgAsre2NdxjPNACoXY07qeJy11RkJuASMgLIgEOgDCPQJWl BAPuDQfxN0QKZewU1BE4RMnzYA1qiKHXARaPKyUeADPUun/a3yve96er0Ldt2RCSUd7F 4pTE8dSlWARmh5fjJqdx8gTvpA+/aVZoCXGuwTv0NuQd48cmIl/zCBpvnSjneF+ZWS5C vllGZ64sreCcHx5NwSJ6tWGzgRLHgIHqGNYz+XBWOVo25yCEBaVva0Ndc2p2mey5sMTK VxcSuB0RseSgvkDxt0/Kpp4MTW49zW3QL0M/ntDfIWvozunlOoJe9GfkOuE41enl8RcW RMsw== 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=NeaN0jWD/SxRDMcvutaUBfjouVQ/RS+ea/tIBFVK6TU=; b=C/8CvoH7hJn3g6iX8QYRvxUq2OAoCeLzdJNAq6j+EO8EAzlrUu3M6EsWXODGtQ6f34 /EtDJWuYVRhtOV3gFt+UwxxLgOTEqDoK9SWcpC++7fhbA/cGDB3n6KBhrey9Sm1HI+uk KSI1mEyk1nzf2QEB5p5RhAtlsT0vFwhWgq3+VUgSrdzZme036X7teZxNPxYQdXIVJQ4L L0rvQgLrqFYJ77ffoS6WaKEIlo4ZFHNTJSiBr6fMwyJBsDMM4stFMjZ/f1b6Fx6FxWM4 6Hv+OfMWPtBmvYGvO+ht2tw0nE/Hd0lwXhT5xm0Kbn2aZpXFhEgfAroN9gVfICavyZFN Jp6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=S1BuFf2X; 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 w22-v6si427236plq.115.2018.04.17.21.44.19; Tue, 17 Apr 2018 21:44:33 -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=S1BuFf2X; 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 S1753924AbeDREmo (ORCPT + 99 others); Wed, 18 Apr 2018 00:42:44 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:34854 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750983AbeDREmn (ORCPT ); Wed, 18 Apr 2018 00:42:43 -0400 Received: by mail-it0-f65.google.com with SMTP id q85-v6so924069itc.0; Tue, 17 Apr 2018 21:42:42 -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=NeaN0jWD/SxRDMcvutaUBfjouVQ/RS+ea/tIBFVK6TU=; b=S1BuFf2XlJH75K/zNruvmFUP0x3IeMi7i3nBlck7VyHJbbnC29eQ+sYkzcU7a4qUt2 W2LrGP5tHQ05H2jXs1Gr1jfzeA7EGXiBZMC3//pmvsP55xmA6sgbwyBiW1SCbePlSdUO F3UVyt+qgeOMqPswJMnJCWfs4TkUmv8qK4R9IFx0BZCe0uFaCb6QHb1K0Npch/Ag9ADq CY0PJqHLT+tlY8gdk7rAYw0l/MS0pn4vaDmlUIf7iQAV74of5zOlQ+dIyosmVmsbTm9W 1R1yTvM23dzr2YaZBowZP1Jq8iPgTfJPbr0ZEvzqmpIxO/SVSInA79br0Ig6pTz2JuH9 jdBQ== 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=NeaN0jWD/SxRDMcvutaUBfjouVQ/RS+ea/tIBFVK6TU=; b=Hjgn822OWX3q/fdAye2o+D+tnGGuIPMFOfyA1vYTjbm0HYLYi56mCjdwCjiZdWi4Y1 JzKsACA40AkJZuaZdwTRtzw/D8qBtT5Cg4sFDzFRIBzrkaX2lNJMEe402qjcn/sQQnLA 67z/3U9eJo36/Za6+gJKwBOlvKJQneXoh7QxNFYbigcsb3GO5pPVZ9obixzPshwI5CJO cubpaCFiKqRZriPUjxXaka1MJtJNE9CW1XCaVf7BrrSJfOC/z6XNWi7xdVQTNuXjRN9O zzaHWH55DNLjVjqtZWAoUMn81hdAhvv0AKFiApcwFh9bmiTTd84+9O2M3uztNmspvgDa +g8Q== X-Gm-Message-State: ALQs6tBVH7EHewGCvNhGrkb5cO2gsznIoLtlRseJ1rI5RURDNeHfGwgc qEtIw3DFqmLVs4aTzcFWkQ33ANV9QRQi1I8yaNc= X-Received: by 2002:a24:1bc4:: with SMTP id 187-v6mr876856its.4.1524026562554; Tue, 17 Apr 2018 21:42:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.181.10 with HTTP; Tue, 17 Apr 2018 21:42:02 -0700 (PDT) In-Reply-To: <20180417234455.q6fgn7oroehmxk6l@ast-mbp> References: <1523892818-12820-1-git-send-email-laoar.shao@gmail.com> <20180417234455.q6fgn7oroehmxk6l@ast-mbp> From: Yafang Shao Date: Wed, 18 Apr 2018 12:42:02 +0800 Message-ID: Subject: Re: [PATCH net-next] net: introduce a new tracepoint for tcp_rcv_space_adjust To: Alexei Starovoitov Cc: Eric Dumazet , David Miller , Song Liu , netdev@vger.kernel.org, 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 Wed, Apr 18, 2018 at 7:44 AM, Alexei Starovoitov wrote: > On Mon, Apr 16, 2018 at 08:43:31AM -0700, Eric Dumazet wrote: >> >> >> On 04/16/2018 08:33 AM, Yafang Shao wrote: >> > tcp_rcv_space_adjust is called every time data is copied to user space, >> > introducing a tcp tracepoint for which could show us when the packet is >> > copied to user. >> > This could help us figure out whether there's latency in user process. >> > >> > When a tcp packet arrives, tcp_rcv_established() will be called and with >> > the existed tracepoint tcp_probe we could get the time when this packet >> > arrives. >> > Then this packet will be copied to user, and tcp_rcv_space_adjust will >> > be called and with this new introduced tracepoint we could get the time >> > when this packet is copied to user. >> > >> > arrives time : user process time => latency caused by user >> > tcp_probe tcp_rcv_space_adjust >> > >> > Hence in the prink message, sk is printed as a key to connect these two >> > tracepoints. >> > >> >> socket pointer is not a key. >> >> TCP sockets can be reused pretty fast after free. >> >> I suggest you go for cookie instead, this is an unique 64bit identifier. >> ( sock_gen_cookie() for details ) > > I think would be even better if the stack would do this sock_gen_cookie() > on its own in some way that user cannnot infere the order. > In many cases we wanted to use socket cookie, but since it's not inited > by default it's kinda useless. > Turning this tracepoint on just to get cookie would be an ugly workaround. > Could we init it in sk_alloc() ? Then in other code paths, for example sock_getsockopt or tracepoints, we only read the value through a new inline function named sock_read_cookie(). Thanks Yafang