Re: [PATCH v3 net-next] net: introduce a new tracepoint for tcp_rcv_space_adjust

From: David Miller
Date: Mon Apr 23 2018 - 09:58:53 EST


From: Yafang Shao <laoar.shao@xxxxxxxxx>
Date: Fri, 20 Apr 2018 23:18:26 +0800

> 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.
>
> 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.
> With these two tracepoints, we could figure out whether the user program
> processes this packet immediately or there's latency.
>
> Hence in the printk message, sk_cookie is printed as a key to relate
> tcp_rcv_space_adjust with tcp_probe.
>
> Maybe we could export sockfd in this new tracepoint as well, then we
> could relate this new tracepoint with epoll/read/recv* tracepoints, and
> finally that could show us the whole lifespan of this packet. But we
> could also implement that with pid as these functions are executed in
> process context.
>
> Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
>
> ---
> v2 -> v3: use sock_gen_cookie in tcp_event_sk as well.
> Maybe we could init sk_cookie in the stack then in other code
> path we just read it other than set it. If that is needed I
> will do it in another new patch.
> v1 -> v2: use sk_cookie as a key suggested by Eric.

Applied, thank you.