From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04CB0C25B4F for ; Mon, 6 May 2024 18:43:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83ABC6B008A; Mon, 6 May 2024 14:43:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7C3C16B008C; Mon, 6 May 2024 14:43:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 664CC6B0092; Mon, 6 May 2024 14:43:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 456986B008A for ; Mon, 6 May 2024 14:43:36 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B9934A1739 for ; Mon, 6 May 2024 18:43:35 +0000 (UTC) X-FDA: 82088844390.06.3CC62C0 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf21.hostedemail.com (Postfix) with ESMTP id F3C2E1C0009 for ; Mon, 6 May 2024 18:43:33 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=I2QIEPdH; spf=pass (imf21.hostedemail.com: domain of irogers@google.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=irogers@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715021014; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=aMqIHyLa/gmjK+J+Bo0q9JLXeRdO7aoxpGEVpFxtErc=; b=N+8Bn9aGWd50fgpGCt6scwjfYiES1CKYEXEHQvJvx9cfqoHUtb4u1rflmM8BwG+WhWFySg CFF0669EvfZ64y/CxCdT8sxY724DkJGMKBtWzfHrXEQtsEuW2bzK18C0OyTfTGWMB2a7FR eVM2QhWcvBjwQmK6/cNhRZE7DZBMwfE= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=I2QIEPdH; spf=pass (imf21.hostedemail.com: domain of irogers@google.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=irogers@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715021014; a=rsa-sha256; cv=none; b=ZsE6F7O9Q1/rNSas3fo7jmsbogUV6wRxc5Thtn6fxlXzXlDMp3iHnIy+llkm4UKxaP/QOJ hgaiEvXspQh5XjR2s9yidlDICZwPxrWhYRBUvaD8g6ENn13HGq269pIS+3f2FbtW1J3WEA YtKwQPZVj4mLIH4fnTehN6fpRxYfNHY= Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1ee5f3123d8so28305ad.1 for ; Mon, 06 May 2024 11:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715021013; x=1715625813; darn=kvack.org; 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=aMqIHyLa/gmjK+J+Bo0q9JLXeRdO7aoxpGEVpFxtErc=; b=I2QIEPdHsVxuikA8yo11m2+LwtQ4dEjELvW8GZFCvPuHtIF9xfWSxNNK9DSR4bdmen sGN5i7+qi4YFA2Fn7Gw0fSiMbtVhsChCak2ClrqVGa68DgiqhT3ysyuiE4pV7aWt4hLl 6T3ocxjQtdCQjK5USQ56xEERLwG+XjsR3hDjNcMJJOOt94OqUbPalfNj8iB5a+6XT+/p q5XApGdNqz+HIlhQLvoBjSF6smTZ6PDiIboiQs7XzYcqPyzy55ZE9j5MMWMZc+sS8/13 ftk94ctL+YapqBZmJdEgcrIAjujc6ugH9DVyvBvPcRpi5Ol1a+Q+/kCQ2a12m8e8U45X mRxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715021013; x=1715625813; 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=aMqIHyLa/gmjK+J+Bo0q9JLXeRdO7aoxpGEVpFxtErc=; b=QVlEXSJP7W2WU8yYtUvdsfmJkbxqcmcRREsyl4tOrG6kYnPH80ZCgeVx04ct4p90HE 3YdA4H85Fj7WcLaQihRY1nTC8EHITjLn7HKMPDL3L4dmWWWKrrdiiZ4bnyjuw8/ggQHZ Au43aOnL3bPQvC5il+zL/NbSZBA7iAdWJV+S6CKkBN7NjMFfMJpvStFO+5uMCeuDjaQI GThgj74Tt9pkXAPb80N9JwIx2S4pzcPclQizjOezt180Fv3YPJ0IbcEauRocoRcSvVYy WNKfeue5lO+eWF88lmVT3BpNjoJ4zC8rPPysII4YgSDFGL3NITPIzKywBlvStdIZacgI +pEg== X-Forwarded-Encrypted: i=1; AJvYcCUg7rCE7+P+tVVixxanvgTY40Mhz4f27MvtujoI+HX5QyUtynGgFB04r54N3T0pejLGOZ72eeTxCpwgaWOlIpB1sv0= X-Gm-Message-State: AOJu0YxA9CUSY5aMfxVPSxnjeBO//1R7lNCFOFfzIjFxrvU5fE4Xekg0 /rbi7EzU0ITKVivgXE55u1IrVDsQ0GUUa+LW3Vps+XcKq9SnNG1TX6PLJFvZeq15nFVcx2/Kl39 ux/fq6FpwwmpfGiST4g0AHex0+rcmdQgQfCvB X-Google-Smtp-Source: AGHT+IFulYHpYLHM1ZuESjR5oSmKrCpxfE2wIN5s61bSGDGu2zfJeu8lvWzNU0Er8XFXuAkgqi4DEDvGGFyMpu+7Ino= X-Received: by 2002:a17:903:2003:b0:1e2:573:eecd with SMTP id d9443c01a7336-1ee6a6a8e32mr195735ad.3.1715021012487; Mon, 06 May 2024 11:43:32 -0700 (PDT) MIME-Version: 1.0 References: <20240504003006.3303334-1-andrii@kernel.org> <20240504003006.3303334-6-andrii@kernel.org> <2024050404-rectify-romp-4fdb@gregkh> In-Reply-To: From: Ian Rogers Date: Mon, 6 May 2024 11:43:21 -0700 Message-ID: Subject: Re: [PATCH 5/5] selftests/bpf: a simple benchmark tool for /proc//maps APIs To: Andrii Nakryiko Cc: Greg KH , Andrii Nakryiko , linux-fsdevel@vger.kernel.org, brauner@kernel.org, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-mm@kvack.org, Arnaldo Carvalho de Melo , "linux-perf-use." Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: yf4fsnjwy48fm3ri4s5esi9ntwi18mmb X-Rspamd-Queue-Id: F3C2E1C0009 X-Rspamd-Server: rspam10 X-Rspam-User: X-HE-Tag: 1715021013-355015 X-HE-Meta: U2FsdGVkX1+Zdx9RIb9LbEZXwjqac0MxPCSC1ZYs2BEfi/y7qjcH8tAnGOPfr1ph33ueJcppE4aeD/S5jjmmywQC9l6xreLyFLq56o6l1jh+WMu2+ykE3+3f9gQdV0oC+Dc1fEF0lzs39RY+Usn1ZaUpYtLBGhO+R9WpoybM8DvjOczn5H19h/CipikmaQU7I0q65nmYa2QmreBIOerI/ZZt9LXOWuEAdAeAnYDiU0I4aB4rwFNsJvKMmSAX2Ikm96JwSUnxDnlsZkYHbmQxxDuGVQ6JQbYApSGI6f4WE5mKGSgr0+pcvOtDEK8fT0w+oBQroIyCGFgqTf43Nd38cUwC8fVxGA7By7/EMT1t/yTwdfj7uOr41zvJ0EIKAo2CTFKLutgFZ+t66fg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29l+Dk7+iKSt0nE8+CYOXs4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000321, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, May 6, 2024 at 11:32=E2=80=AFAM Andrii Nakryiko wrote: > > On Sat, May 4, 2024 at 10:09=E2=80=AFPM Ian Rogers w= rote: > > > > On Sat, May 4, 2024 at 2:57=E2=80=AFPM Andrii Nakryiko > > wrote: > > > > > > On Sat, May 4, 2024 at 8:29=E2=80=AFAM Greg KH wrote: > > > > > > > > On Fri, May 03, 2024 at 05:30:06PM -0700, Andrii Nakryiko wrote: > > > > > Implement a simple tool/benchmark for comparing address "resoluti= on" > > > > > logic based on textual /proc//maps interface and new binary > > > > > ioctl-based PROCFS_PROCMAP_QUERY command. > > > > > > > > Of course an artificial benchmark of "read a whole file" vs. "a tin= y > > > > ioctl" is going to be different, but step back and show how this is > > > > going to be used in the real world overall. Pounding on this file = is > > > > not a normal operation, right? > > > > > > > > > > It's not artificial at all. It's *exactly* what, say, blazesym librar= y > > > is doing (see [0], it's Rust and part of the overall library API, I > > > think C code in this patch is way easier to follow for someone not > > > familiar with implementation of blazesym, but both implementations ar= e > > > doing exactly the same sequence of steps). You can do it even less > > > efficiently by parsing the whole file, building an in-memory lookup > > > table, then looking up addresses one by one. But that's even slower > > > and more memory-hungry. So I didn't even bother implementing that, it > > > would put /proc//maps at even more disadvantage. > > > > > > Other applications that deal with stack traces (including perf) would > > > be doing one of those two approaches, depending on circumstances and > > > level of sophistication of code (and sensitivity to performance). > > > > The code in perf doing this is here: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree= /tools/perf/util/synthetic-events.c#n440 > > The code is using the api/io.h code: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree= /tools/lib/api/io.h > > Using perf to profile perf it was observed time was spent allocating > > buffers and locale related activities when using stdio, so io is a > > lighter weight alternative, albeit with more verbose code than fscanf. > > You could add this as an alternate /proc//maps reader, we have a > > similar benchmark in `perf bench internals synthesize`. > > > > If I add a new implementation using this ioctl() into > perf_event__synthesize_mmap_events(), will it be tested from this > `perf bench internals synthesize`? I'm not too familiar with perf code > organization, sorry if it's a stupid question. If not, where exactly > is the code that would be triggered from benchmark? Yes it would be triggered :-) Thanks, Ian > > Thanks, > > Ian > > > > > [0] https://github.com/libbpf/blazesym/blob/ee9b48a80c0b4499118a1e8= e5d901cddb2b33ab1/src/normalize/user.rs#L193 > > > > > > > thanks, > > > > > > > > greg k-h > > >