Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp12702068rwl; Tue, 3 Jan 2023 19:43:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXsLW9jgdORF3PXFs2fbnsBV3xD8vuTaMYiSMcjlUDN7a1kqD7ACwWbzwv677zHxWW/v9ocg X-Received: by 2002:a17:906:27c5:b0:7c0:c220:a33d with SMTP id k5-20020a17090627c500b007c0c220a33dmr46383078ejc.9.1672803820886; Tue, 03 Jan 2023 19:43:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672803820; cv=none; d=google.com; s=arc-20160816; b=MwxvK4vhoJBYmDtnnENa4NwDW2XH6qcMdEVgFpC0drJYTJpz251OE7lQFod5CvPowA /O9iQdhPYUjycc4Y6U+smK5OksZO1OP0ORlNGvZinC3HOJ8s6bBWeoIbeYgByK7L7Z+J MrPp1uNuaJjNZCKi15VsM+K6w/COGAEoZhYwH4sXd/u2B20ues1jyp3CeWRSPByGvfPC vApGyhRniHYfmrYqqPvoPAA4bnoYNp+VaWMmvN4EtZEY+mMMJyJAN5ZOmmreUqdE2cgp 2JYRbV/vfYRkIl8l1BfjumyH8CrolW1KydqukH89C38/CSqMl0Rg+6GMNPn34lqMxllx 46Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=gsvk33R4DYQucuzlILv604rElypjCvBYNtIeYzz0ItU=; b=c7CmE1zGjygcvSq2NRY7OBzmJdOw1JKcu+1Fm1AA0N/wxkbnp8k29hH2bndOaxYsO1 N25EbAJ9XYgAB9QY+p3gMw1vwNw7DSQQop1bjB/c2niE2zdNMRSiKgfYXNiYiGMwf2dU rJ96KhymCg9Bu9jqG/4GIWJ6w2g/YrAl/jN0uSRRXtjMl/vX3IhrZzytT1pcB0ePWiwq L2bxzy1uSosLQ8+VAp7QLZGJszn2QzG6YbKvfAxwjGjUCbLkupCm52bIm/fJQSRnyD5x kMgJ984/7aeqHkbuassjAbS9KF7AiGCtcBlIjOaKj6pQYVf5rjK79cJSoE1mGaGvxSgF qQKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="3oPy7+/j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz8-20020a1709077d8800b007c0c9bd6206si31664029ejc.553.2023.01.03.19.43.27; Tue, 03 Jan 2023 19:43:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="3oPy7+/j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234390AbjADDfb (ORCPT + 57 others); Tue, 3 Jan 2023 22:35:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbjADDf3 (ORCPT ); Tue, 3 Jan 2023 22:35:29 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3D6C165BC for ; Tue, 3 Jan 2023 19:35:05 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so25540063wms.2 for ; Tue, 03 Jan 2023 19:35:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=gsvk33R4DYQucuzlILv604rElypjCvBYNtIeYzz0ItU=; b=3oPy7+/jBszDhLigAlcyWJ6kZj7wuKNL8KKHikey1QL2RrHkm82yqN0HrLoHfyD/Np hvADAUjv04m5PtaKw+YETVRcGYgSUcZQdM3QEBMIYe6u/N58dvcESEvokUVObcQosnTb PZZC27Ng0YvD/2QcKhqwXrwm+i4vqLP7ofMRRlX2xMgGY+PdM8j/v2oFtuD13+Tnq/8g 6lFuZCOcWtfaNQztCOmwqHRTmhvjaKPd+M+/tProuJU1f9ByAZKYmMYwPeLTzqWqfHr/ W66+LngGprgSggAPkGil5/MvRA7CP6EtYiA+eEAfNaWTSqqQcKNEtmMAEyIA64wmpCT5 Z+9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gsvk33R4DYQucuzlILv604rElypjCvBYNtIeYzz0ItU=; b=C2u1YOqRUSnYuIPjn+sZ7Is3EFqHMLcQHbYufMGU+JbMi1S7pZI6wb4kjZbBVYkp/F G0kIkwe1CF6kEztSDzHilK0itmlpSBGIGQ4ffHNLBp1EgqPcGI4rHVqybYMX3fqbgYfH 6KRaHVTmVRp3OSiZ3kCYgR9j/X1UbfOY79PlzRpt/pz74qJwielb8x1iBETNJbcI6IR1 vUQSk0A1Ni+RG0n0qPUkcF7IlmZc4ZUbETp3gFoRFQR+djoIH2shjNkpzh7KotH3cd0S L51aJnXrrmLoe5wpdRJg1tRBSKtNQrTb7gFaLaoyD6bj4WXw5MCCcjY6ZapBC+W1Xqmy ewIA== X-Gm-Message-State: AFqh2kpuO5GGZfsGSeFnGdXpouNGBSrs3p17rhIEmAjPu0yJPfe+tqLZ FTmYXtsrXkFGztqZVUttZSu8NfR6ok0fKcT39O87/A== X-Received: by 2002:a05:600c:3503:b0:3cf:8952:2fd2 with SMTP id h3-20020a05600c350300b003cf89522fd2mr2897959wmq.9.1672803304583; Tue, 03 Jan 2023 19:35:04 -0800 (PST) MIME-Version: 1.0 References: <20221229080207.1029-1-cuiyunhui@bytedance.com> In-Reply-To: From: =?UTF-8?B?6L+Q6L6J5bSU?= Date: Wed, 4 Jan 2023 11:34:53 +0800 Message-ID: Subject: Re: [External] Re: [PATCH] tcp/udp: add tracepoint for send recv length To: Cong Wang Cc: edumazet@google.com, rostedt@goodmis.org, mhiramat@kernel.org, davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, duanxiongchun@bytedance.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Cong Wang =E4=BA=8E2023=E5=B9=B41=E6=9C=882=E6= =97=A5=E5=91=A8=E4=B8=80 03:10=E5=86=99=E9=81=93=EF=BC=9A > > On Thu, Dec 29, 2022 at 04:02:07PM +0800, Yunhui Cui wrote: > > From: Xiongchun Duan > > > > Add a tracepoint for capturing TCP segments with > > a send or receive length. This makes it easy to obtain > > the packet sending and receiving information of each process > > in the user mode, such as the netatop tool. > > You can obtain the same information with kretprobe: > https://www.gcardone.net/2020-07-31-per-process-bandwidth-monitoring-on-L= inux-with-bpftrace/ As we know, kprobe gets the result by trapping in an exception, which loses performance compared to tracepoint. We did a test for performance comparison. The results are as follows. Time per request sock_sendmsg(k,kr): 12.382ms=EF=BC=8C tcp_send_length(tracepoint): 11.887m= s=EF=BC=8C without hook=EF=BC=9A11.222ms It can be seen that the performance loss of tracepoint is only half of that of kprobe.