Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp764570lqp; Wed, 22 May 2024 21:34:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfEKdgMfpN0ChXzV4Z6IyCGu/o1RhKKZgI/Lt3ZFMDCwpUrYxOgDG/LxkRdk8+lVBavapxuzZwY31FxtxAmKxj7VOh71P0ZzuhwkRqwA== X-Google-Smtp-Source: AGHT+IFYvqPjmMhN4GvznisACXlhc+rBYH3YrdtUJ4F4oMXtcjA1Vfbk47zMo3b9y/glJONFqeBy X-Received: by 2002:a05:6870:148a:b0:245:2f02:84f3 with SMTP id 586e51a60fabf-24c68d8105emr4121974fac.55.1716438885483; Wed, 22 May 2024 21:34:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716438885; cv=pass; d=google.com; s=arc-20160816; b=JwsdciRwUXbxvvouLp4XjYmNar5y1eVvM4reTk6kWm931Vc/RRdFUBJVxDAuB2uJqJ xK06ZYvjVr//Zgyd7tNz10DgZ+p+q/JckrC3defjkSUGYYFSjjVScKBOJOxO8a2mOzxo PFzCvyrmKWEiIl3YeVZ6IFFEiPceXEKtYehheWLj1E3mGuzCgKaQ4wrOqFj+8q8EE1C/ B8qTKkA2aQQ4GLWx81bAH9NnkhUmM4d/ZIyKaRgd2AyPeJbpkNnlAj/LTVloAu/SMrbQ g7WG8ueQyAAA/ZhAFU0zfzQLKvYOJjMp4IH6uojTTLE6TF5M1yB9wQdvSRD/+bvXvz5J yubQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=at5UxiV48avlyrvXoXbH6Ae16IV46P5/O03jUQ7gmcY=; fh=d0xv38ElmOBK9ap04JfyouFYDEoDJWLtxy3qm1y1Owk=; b=blhP9LCKP2qLWkszH55IKU2+0kY4138rsCsTz+v9uc5AJwp5Vl+iHNGi+BXp0r0FgZ XsoJVA/lHgN5ZIWGVRcm6sdOCBeNLJjZEiYK8EqYB54zldGVvmiIhdQArRrCdWFO5GZj jO3NWTVJP8u4zi/le5NoAKuyUQRObZoA2Wsjyg0gzk1Kk1XVyx3UCL4dNcp/uPzazruT 98bj4rQhEzQSMnD6aoiqEAVp+oEgk6f7L+3brBZsT2LflggRtjsHVdZLdxOVv55E9hiE nXgLRl+CXWfOM+SzWtWXCjBmtAZqmrlNhb7sCYufPk1FRpIR0syCHnB47Gpq0NTh3pTA PlZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-186976-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186976-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-63409e8234fsi26683375a12.139.2024.05.22.21.34.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 21:34:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186976-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-186976-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186976-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0FDB12833E1 for ; Thu, 23 May 2024 04:34:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8131D53363; Thu, 23 May 2024 04:34:35 +0000 (UTC) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D1203C0B; Thu, 23 May 2024 04:34:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716438874; cv=none; b=uK2VnbGhQU5S+UNXhaicS0/QcfSQxPvpFEuuh9dQfYgNBPleX46PpPx+usSjfqvjX/XBLyMYhBR6wKI5rY5iVS243xneWl9RxRu4jrAQrA1iZjutjAnTA4NFSpvEr3O9ePn+ZNipvoYRUh8LeGiu4E4Xim2MkldeuPICW0E9HL4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716438874; c=relaxed/simple; bh=hS9Acnxk7Hffa/ZSk/2BXr9V4kB09rgT1BDZLI6R4ME=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=PoGo+NE6bRJ7EEHejqKtJzmpAxCgr6X+Gp1baIHWYeNkYWOsT5magpQYAvLRktIOVEMrVJUT2wJg/S9Fuge242PoRav0TbRKe+mYVZ1CCQpLHbN9BT2MDRcS79QLkCqzfwn/Lo19mwtJAVQR8+xxORKSyFdfOH8xrOtECdrIgCQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-2bdb61c5fdbso629685a91.2; Wed, 22 May 2024 21:34:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716438873; x=1717043673; 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=at5UxiV48avlyrvXoXbH6Ae16IV46P5/O03jUQ7gmcY=; b=mfH/33s4XmpjTPJCM+5n0XWZ+RdnhxdgbI4tNQtKHILlb4atvvJ1nRiFzkY1iQcA9u WhM3rXW0RwpEjwBU/OcuVenw+AWHmsCMv22qNQpiUHwabzDlNM00dsp73HKqTuvcEMCb XgZ0e1JmHphW8rx6DY8m+in3KEvkZxSW+5EueLJ9GbJiRtYExZvEqMcFdUA3c2WZlX8b XoSx2X0pl7/V9nVELs3Yf9RddbI55roUJohirjIOfyk/OtYsIpDX9lXhZZ07rHZlU4iT EfV5iGWilTbjZzjGPWhu5jkG8T1SC5R5QDvVKG2BS3Q3Q6oSfti+wlgnjyjd0EQoZGiA 9oOw== X-Forwarded-Encrypted: i=1; AJvYcCWo66UuDemO2kCT3RaSkLfFBHCaBMu3viKV1eQJl52seBX6kaDC0OypoSJsa/y1aEk8+pNmw6uNonfzkHxUw565qdvWuqv9Dn/p3jCQAym8DsgT5pvQEkBxaISd9Fe/4LPLgI6n4rU+D+T7+KwD0M/FFGAqpcaTQSgUtl6aReotCBM7Rw== X-Gm-Message-State: AOJu0YwqEgV0Q6BFPzyUGo+7+1ECdKjrzVvsY778hh2N2QaJwcs3m0+2 woaQ8p/SQbpYs5OeRI1xPWsNitApMvxifPTtdaoQbCvNlBOX/DfO9WDuEaNmyJRgUospwUpCQBa Dw/8J9c1p5S51Zz+zWcZ02VgEcGA= X-Received: by 2002:a17:90a:ff15:b0:2b9:dd9c:34cb with SMTP id 98e67ed59e1d1-2bd9f477f2amr3803344a91.27.1716438872775; Wed, 22 May 2024 21:34:32 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240424024805.144759-1-howardchu95@gmail.com> In-Reply-To: From: Namhyung Kim Date: Wed, 22 May 2024 21:34:21 -0700 Message-ID: Subject: Re: [PATCH v2 0/4] Dump off-cpu samples directly To: Ian Rogers Cc: Howard Chu , Arnaldo Carvalho de Melo , peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, adrian.hunter@intel.com, kan.liang@linux.intel.com, zegao2021@gmail.com, leo.yan@linux.dev, ravi.bangoria@amd.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, On Wed, May 15, 2024 at 9:56=E2=80=AFPM Ian Rogers wro= te: > > On Wed, May 15, 2024 at 9:24=E2=80=AFPM Howard Chu wrote: > > > > Hello, > > > > Here is a little update on --off-cpu. > > > > > > It would be nice to start landing this work so I'm wondering what t= he > > > > minimal way to do that is. It seems putting behavior behind a flag = is > > > > a first step. > > > > The flag to determine output threshold of off-cpu has been implemented. > > If the accumulated off-cpu time exceeds this threshold, output the samp= le > > directly; otherwise, save it later for off_cpu_write. > > > > But adding an extra pass to handle off-cpu samples introduces performan= ce > > issues, here's the processing rate of --off-cpu sampling(with the > > extra pass to extract raw > > sample data) and without. The --off-cpu-threshold is in nanoseconds. > > > > +-----------------------------------------------------+----------------= -----------------------+----------------------+ > > | comm | type > > | process rate | > > +-----------------------------------------------------+----------------= -----------------------+----------------------+ > > | -F 4999 -a | regular > > samples (w/o extra pass) | 13128.675 samples/ms | > > +-----------------------------------------------------+----------------= -----------------------+----------------------+ > > | -F 1 -a --off-cpu --off-cpu-threshold 100 | offcpu samples > > (extra pass) | 2843.247 samples/ms | > > +-----------------------------------------------------+----------------= -----------------------+----------------------+ > > | -F 4999 -a --off-cpu --off-cpu-threshold 100 | offcpu & > > regular samples (extra pass) | 3910.686 samples/ms | > > +-----------------------------------------------------+----------------= -----------------------+----------------------+ > > | -F 4999 -a --off-cpu --off-cpu-threshold 1000000000 | few offcpu & > > regular (extra pass) | 4661.229 samples/ms | > > +-----------------------------------------------------+----------------= -----------------------+----------------------+ What does the process rate mean? Is the sample for the off-cpu event or other (cpu-cycles)? Is it from a single CPU or system-wide or per-task? > > > > It's not ideal. I will find a way to reduce overhead. For example > > process them samples > > at save time as Ian mentioned. > > > > > > To turn the bpf-output samples into off-cpu events there is a pass > > > > added to the saving. I wonder if that can be more generic, like a s= ave > > > > time perf inject. > > > > And I will find a default value for such a threshold based on performan= ce > > and common use cases. > > > > > Sounds good. We might add an option to specify the threshold to > > > determine whether to dump the data or to save it for later. But idea= lly > > > it should be able to find a good default. > > > > These will be done before the GSoC kick-off on May 27. > > This all sounds good. 100ns seems like quite a low threshold and 1s > extremely high, shame such a high threshold is marginal for the > context switch performance change. I wonder 100 microseconds may be a > more sensible threshold. It's 100 times larger than the cost of 1 > context switch but considerably less than a frame redraw at 60FPS (16 > milliseconds). I don't know what's the sensible default. But 1 msec could be another candidate for the similar reason. :) Thanks, Namhyung