Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp134910lqo; Tue, 7 May 2024 14:58:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUHlms6sQKsHtpBxcQHVUHM9YkPPzRXaxKrMzmtTSav2mfiXf866cuUlEWQquNxqBpTIsHkU/+AQuuxPUMgzxG3Vt2Z+W4YmGqCLBzIQA== X-Google-Smtp-Source: AGHT+IGH1J2h7gXbczpRv/L/Af5DAEXmm4FSlaIsnncoJZxFRK6UAuwWmJD7UMwQo0kdElBXd8RV X-Received: by 2002:a17:902:848e:b0:1ec:3ae4:cfe9 with SMTP id d9443c01a7336-1eeb0697e47mr8439405ad.33.1715119125076; Tue, 07 May 2024 14:58:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715119125; cv=pass; d=google.com; s=arc-20160816; b=FBQIivnAkI+KPbzUpOLms9vjmVV7uNWEZz25KM2kZa5Vi6sEQsXhLEFX1r8KQDON+V o/kcOHlYuf6a5AJ/VYt/vZK6NthexlOvl0Q8ME9uIteliIHZgh1yQ37lbgQZAn0QYGWS EwtYiHqGZaJPNyipRUxpmDm8KP3uDFfF/LIFptlVLl4zGw/4n7CSVAhlB7OamVS8q+yD TgR5e43e0fGSMwetiC3ayfEKAtn8p4jcWAvYM/kEBvi6Suz0opk/WQtvBB10Ah8Le9+Y Vt6n3GAHfgRQysK4qfIyERz+aPo30bRBKRuMKX+buMKrZjbHEHmSF41y12AgIYXkuWny 5l8Q== 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=nXTaPie4n8q7aWd8lKqdehPO2SNuKWmtizpezocD5H4=; fh=aBOqp73x9GC7tlEt1eW+JxuU3cb/jfQXZisK+UTOziw=; b=qb0WPXkLo5p99VrLUAHlR2j00XtXwBppOpV1dgXPMCHa5gsajx5YzjcFucAB5IoA4K sXzLnKcpjp0HkuA8fl1rdlrYGuwT9DeUwff8R1Zpefz2N/Hp3dPcPbKvh0rrvNpEOSyk /3Ip9DfGBeOEeCJrxbIumGaqUvB4SI+178YG4rYnZ5ZU1N5qO04IZmK+bu2miE/tE7f4 GTx3Wcb7KiE1mfM0bjPpAqWTgrihV0c0Mcg/jROrS4j6HbO1nX/hjaIUIiqSYPd9Fz0P 9DwM7Tw3Abtxk6anVywCqgNmPxWFFTBmrCk5CKPz/8kpqobz8kDG1PPa5Phz51qtKTGZ d73w==; 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-172234-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172234-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id p11-20020a170902e74b00b001ec9b4f7ab4si11409860plf.30.2024.05.07.14.58.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 14:58:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172234-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-172234-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172234-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E6D5BB221A3 for ; Tue, 7 May 2024 21:56:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA8C716D4C4; Tue, 7 May 2024 21:56:07 +0000 (UTC) Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (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 B64C179CF; Tue, 7 May 2024 21:56:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715118967; cv=none; b=Sn/EJ+YK1AwL+SKrEI6Fvigk9+3q+NUqDhrc4EhDw/mnIj21W3bEbzTU6F27vkqVkm8lGT5vC9lGHRWrliN0nxBtRmEW1b6uH0+xlnbYR/m6SYJaDKs/kaHOnhF/aZ4Ti5BpLQFyvkTOBDKN+x0EC34XNKKWag1q2OcrtC3X11s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715118967; c=relaxed/simple; bh=c6YHGEYmPjpO9D/p2b9v83LdrifgicmhUFUwgBtopaI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=YqB9NJMJed0H5VWmyvBmYQeBPETNrrHfGS6+YvXFhofXbaiMSCaLH3jYaZTs1+6u/FOJkqHMJn6ra3UVJpDOE190kpYaDSDxRxcasKd833pOZa8h6oORUWfLDnOKfqikXwBPaUhPr1AZyI36D6h+Xm+4CMnSopF/vMb1jjv5Lus= 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.215.173 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-pg1-f173.google.com with SMTP id 41be03b00d2f7-61aef9901deso2510504a12.1; Tue, 07 May 2024 14:56:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715118965; x=1715723765; 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=nXTaPie4n8q7aWd8lKqdehPO2SNuKWmtizpezocD5H4=; b=g9QpDvlOJwdxgjipCk2RplWsuZ+Vn4tRzRNZavLWVZiQ4mUsjpGo14ZsauiboTAuAK aaAPPjWSF+hxSNG2/K/ls/xgrk/e55xXm5tG2Lo84DR0DaLRIZlnPyfsBH+7Yz/frfTC Y4VfYwBf5Dsg5wNlF/LjveB+5FVO4q9b/6/W6WjknS4bHXIewBDTchpFiabzoYOgasJP t765XvcjWLvWy/JKnHmi3OcSOiqEqLeNCVrP9PmdYg2xI2oh7ywtkyvqJ0ImQqV0TeXY BhaNM8H9mrefaByESrkCo8TV8L5veV2Ih0vhvcWP9thVtjvV0sbSSiGSHaDRTgGMMuCb JHCA== X-Forwarded-Encrypted: i=1; AJvYcCXH8RFDpuyLH27tlWpjwdQbHU3tDCAPG5DH/MbMV0vIOXTPaUQ+VKgNB6tMyENoYJOt7fg1FYD2rp9OgJiXQJDAj+VB8oyqeirLfUZ0zAbnHO03s83h9GqZkQhhPE8BSn0fvqU3q2ZQbJR7KYWEiUkorQbRqpTTXtliKm9Le+EPqiFAhLxVtb0lvGhHFMKdDTFazLTfqj2UKtdFLBbLRIZZC7o= X-Gm-Message-State: AOJu0YxVMaZ4zQXlFdcoZ+Lvh5OhNQ7cOhrpQp4uNs4sgJIFMW+/F11R XOAOkn/x/vVo1HT2vEPMi1uGyq1bAmtkOtyk7Z7NaP1wmyHf/Of6ga0kzBUm89jCcQE4yVi3H59 bR8i1PhBpcvMPiSLAvNd+UAS71HI= X-Received: by 2002:a17:90a:cf14:b0:2b3:ed2:1a91 with SMTP id 98e67ed59e1d1-2b616ae2ca0mr732222a91.45.1715118965098; Tue, 07 May 2024 14:56:05 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240504003006.3303334-1-andrii@kernel.org> <20240504003006.3303334-3-andrii@kernel.org> <2024050439-janitor-scoff-be04@gregkh> In-Reply-To: From: Namhyung Kim Date: Tue, 7 May 2024 14:55:53 -0700 Message-ID: Subject: Re: [PATCH 2/5] fs/procfs: implement efficient VMA querying API for /proc//maps To: Arnaldo Carvalho de Melo Cc: Andrii Nakryiko , Jiri Olsa , Ian Rogers , 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, =?UTF-8?Q?Daniel_M=C3=BCller?= , "linux-perf-use." Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, May 6, 2024 at 12:16=E2=80=AFPM Arnaldo Carvalho de Melo wrote: > > On Mon, May 06, 2024 at 03:53:40PM -0300, Arnaldo Carvalho de Melo wrote: > > On Mon, May 06, 2024 at 11:05:17AM -0700, Namhyung Kim wrote: > > > On Mon, May 6, 2024 at 6:58=E2=80=AFAM Arnaldo Carvalho de Melo wrote: > > > > On Sat, May 04, 2024 at 02:50:31PM -0700, Andrii Nakryiko wrote: > > > > > On Sat, May 4, 2024 at 8:28=E2=80=AFAM Greg KH wrote: > > > > > > On Fri, May 03, 2024 at 05:30:03PM -0700, Andrii Nakryiko wrote= : > > > > > > > Note also, that fetching VMA name (e.g., backing file path, o= r special > > > > > > > hard-coded or user-provided names) is optional just like buil= d ID. If > > > > > > > user sets vma_name_size to zero, kernel code won't attempt to= retrieve > > > > > > > it, saving resources. > > > > > > > > > Signed-off-by: Andrii Nakryiko > > > > > > > > Where is the userspace code that uses this new api you have cre= ated? > > > > > > > So I added a faithful comparison of existing /proc//maps vs = new > > > > > ioctl() API to solve a common problem (as described above) in pat= ch > > > > > #5. The plan is to put it in mentioned blazesym library at the ve= ry > > > > > least. > > > > > > > > > > I'm sure perf would benefit from this as well (cc'ed Arnaldo and > > > > > linux-perf-user), as they need to do stack symbolization as well. > > > > > I think the general use case in perf is different. This ioctl API is= great > > > for live tracing of a single (or a small number of) process(es). And > > > yes, perf tools have those tracing use cases too. But I think the > > > major use case of perf tools is system-wide profiling. > > > > > For system-wide profiling, you need to process samples of many > > > different processes at a high frequency. Now perf record doesn't > > > process them and just save it for offline processing (well, it does > > > at the end to find out build-ID but it can be omitted). > > > > Since: > > > > Author: Jiri Olsa > > Date: Mon Dec 14 11:54:49 2020 +0100 > > 1ca6e80254141d26 ("perf tools: Store build id when available in PERF_= RECORD_MMAP2 metadata events") > > > > We don't need to to process the events to find the build ids. I haven't > > checked if we still do it to find out which DSOs had hits, but we > > shouldn't need to do it for build-ids (unless they were not in memory > > when the kernel tried to stash them in the PERF_RECORD_MMAP2, which I > > haven't checked but IIRC is a possibility if that ELF part isn't in > > memory at the time we want to copy it). > > > If we're still traversing it like that I guess we can have a knob and > > make it the default to not do that and instead create the perf.data > > build ID header table with all the build-ids we got from > > PERF_RECORD_MMAP2, a (slightly) bigger perf.data file but no event > > processing at the end of a 'perf record' session. > > But then we don't process the PERF_RECORD_MMAP2 in 'perf record', it > just goes on directly to the perf.data file :-\ Yep, we don't process build-IDs at the end if --buildid-mmap option is given. It won't have build-ID header table but it's not needed anymore and perf report can know build-ID from MMAP2 directly. Thanks, Namhyung