Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1456254rwl; Fri, 31 Mar 2023 11:22:03 -0700 (PDT) X-Google-Smtp-Source: AKy350bnRtG258fkbEAmozErPn6awIELHcJ9NS6Mo2OYh2/cxO/SmLq1RuKiF3i222ouWlmU2EBG X-Received: by 2002:a17:902:c94c:b0:1a2:6092:2193 with SMTP id i12-20020a170902c94c00b001a260922193mr7312760pla.4.1680286923333; Fri, 31 Mar 2023 11:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680286923; cv=none; d=google.com; s=arc-20160816; b=0iFzFE90PS8oP2TDCBOOSxaR0ei6yOTs426Nq6oaJW6JHdUdocSdHim95/8KmKMzC5 wn5JhVkmrkY+hLkwTZjxncUktNc2YwrMbqlWyIh1F735oNNf6JdkqKnfMMWD+w3kZ8wa ndzyXlwv34EwZgP98IQP9K2Z6CGMqLGic+dm8jxJnW1tmahKZBUjjVy0Syb8qYyzdlUn aiReWZhKDAqSi7mGV6lAcTtutHxbN57vBi8qznSNw9JlZDky1eVKqb+OGFPn7YUkwKB2 f4V8ZdRvsIWVUR7r7Vx6892agDFzo5/FL/q7Bgvjs9EgE7dR+91PxxEC+7kLZEXVmoPe LpGQ== 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=ptCDsCZ9M1AP2auqMhwxD2e0Wct9w+HUGpQl1ZXGBuE=; b=bpiaZF2BQ9AzebsKJuexiq9MPqKapSliBzuObQ3PDIm2p/D8BvEcsJp2rbMFFtq/jq lR/R0cyWWoW+7kanB19SIxUuDf+u1h1CpzcfkTNK7Ji4bFdctYlFxl+cerCTY7QqC1F0 5gAD28YnC22c0tOgqlpObEBL7+uo1ewqXeiWC1ckkIbMr4APp8xroILTD3g21jfp/dkL /ZIMTmYOnTa+CxVcUK5vt1aLg6NJUm+q9Cm1aDDLWw+DMtVr0PAS+6mum5cBWs8gq6Ma NTZow2YFEqfC+fhLCVztFARmegVcvaI5JMz7ONNuhhRGYSxyaEFQ7YD7aEhNlamlNxn6 ADDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Gw584kuB; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q5-20020a170902788500b001967d895ce0si2509515pll.213.2023.03.31.11.21.51; Fri, 31 Mar 2023 11:22:03 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=Gw584kuB; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231879AbjCaSUB (ORCPT + 99 others); Fri, 31 Mar 2023 14:20:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbjCaSUA (ORCPT ); Fri, 31 Mar 2023 14:20:00 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 039D449CD; Fri, 31 Mar 2023 11:19:59 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id ek18so93152982edb.6; Fri, 31 Mar 2023 11:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680286797; 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=ptCDsCZ9M1AP2auqMhwxD2e0Wct9w+HUGpQl1ZXGBuE=; b=Gw584kuBZB4NgIUzfMojlADjttI/sZS9NQ+lUHsKb0GpFWzrCiX5KxgPEM6YM3wfKb L7qyK+P8fd+4VG+CXmujXlxC7BXlewyQ8+k2Te9ebzk+rMzpahTWnav1kHCwZ0u4nDMK qSYzdA+/2PNTicJltJMZRFMjFud3XUTM6iTecSpNvUfmcC4NBDmoiTEsW6VNG4voh0Pl Dd3fimhzfdzOlXUg1Eycw8horsLfQpEwQdTlxhLhd1mTanssQvPjrFvkfEsYOGyq/O+I O9I5u9eAGOgFNajpeowt/EpJIH9cYLLO3sQlQulNKMqZZ9G9hP2k4+Rc4AmRLMzBFnll /QuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680286797; 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=ptCDsCZ9M1AP2auqMhwxD2e0Wct9w+HUGpQl1ZXGBuE=; b=jCSBCXIgL9Z7jCOL+IrNjMh758tclOOq7YbFS2e0VQCIo9OgvfpMjyNFxbIdAZqOrH Aq2yG2FiAKm7dkV7N/lLYy3cg+7qH9W1mdIMuE2Yra8d/89yH9UgIKxAikL5VDNijpTd r4mTgPIFfyZKjX1ObirgAhmsTTToKGBb7IBnbY52kYgP02TTbbvi/IFn1MnzTvB2RNaj dFyDj8NpED4wnh3mz0AT/CyBYGmz+FXiF1UjfZ+I+zyoZVhK/DdusjohaXmuh6mvJ61P S6NwpDd1d7wPQbSi0uUvbw0IjJ+iXYxRHH7Ngl5bKd3FnvGHq6jw/fQmHgsc/uk1BsyY 6rsA== X-Gm-Message-State: AAQBX9dUGj5lfghSVmNDTzUVVushyj7o6Hwh/PU18TtK5KJJpPJl4rSS +cSQGFPXjsUJ92G7clq/5IWRBv9FGjU+QSosiFtoYRHR X-Received: by 2002:a50:d694:0:b0:4fc:f0b8:7da0 with SMTP id r20-20020a50d694000000b004fcf0b87da0mr14424020edi.1.1680286797322; Fri, 31 Mar 2023 11:19:57 -0700 (PDT) MIME-Version: 1.0 References: <20230316170149.4106586-1-jolsa@kernel.org> In-Reply-To: From: Andrii Nakryiko Date: Fri, 31 Mar 2023 11:19:45 -0700 Message-ID: Subject: Re: [PATCHv3 bpf-next 0/9] mm/bpf/perf: Store build id in file object To: Arnaldo Carvalho de Melo Cc: Matthew Wilcox , Jiri Olsa , Alexei Starovoitov , Andrii Nakryiko , Hao Luo , Andrew Morton , Alexander Viro , Peter Zijlstra , Ingo Molnar , bpf@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-perf-users@vger.kernel.org, Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Daniel Borkmann , Namhyung Kim , Dave Chinner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 On Wed, Mar 22, 2023 at 8:45=E2=80=AFAM Arnaldo Carvalho de Melo wrote: > > Em Sat, Mar 18, 2023 at 03:16:45PM +0000, Matthew Wilcox escreveu: > > On Sat, Mar 18, 2023 at 09:33:49AM +0100, Jiri Olsa wrote: > > > On Thu, Mar 16, 2023 at 05:34:41PM +0000, Matthew Wilcox wrote: > > > > On Thu, Mar 16, 2023 at 06:01:40PM +0100, Jiri Olsa wrote: > > > > > hi, > > > > > this patchset adds build id object pointer to struct file object. > > > > > > > > > > We have several use cases for build id to be used in BPF programs > > > > > [2][3]. > > > > > > > > Yes, you have use cases, but you never answered the question I aske= d: > > > > > > > > Is this going to be enabled by every distro kernel, or is it for sp= ecial > > > > use-cases where only people doing a very specialised thing who are > > > > willing to build their own kernels will use it? > > > > > > I hope so, but I guess only time tell.. given the response by Ian and= Andrii > > > there are 3 big users already > > > > So the whole "There's a config option to turn it off" shtick is just a > > fig-leaf. I won't ever see it turned off. You're imposing the cost of > > this on EVERYONE who runs a distro kernel. And almost nobody will see > > any benefits from it. Thanks for admitting that. > > I agree that build-ids are not useful for all 'struct file' uses, just > for executable files and for people wanting to have better observability > capabilities. > > Having said that, it seems there will be no extra memory overhead at > least for a fedora:36 x86_64 kernel: > > void __init files_init(void) > { > filp_cachep =3D kmem_cache_create("filp", sizeof(struct file), 0, > SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT, N= ULL); > percpu_counter_init(&nr_files, 0, GFP_KERNEL); > } > > [root@quaco ~]# pahole file | grep size: -A2 > /* size: 232, cachelines: 4, members: 20 */ > /* sum members: 228, holes: 1, sum holes: 4 */ > /* last cacheline: 40 bytes */ > [acme@quaco perf-tools]$ uname -a > Linux quaco 6.1.11-100.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Feb 9 20:3= 6:30 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux > [root@quaco ~]# head -2 /proc/slabinfo > slabinfo - version: 2.1 > # name : tunables : slabdata > [root@quaco ~]# grep -w filp /proc/slabinfo > filp 12452 13056 256 32 2 : tunables 0 0 = 0 : slabdata 408 408 0 > [root@quaco ~]# > > so there are 24 bytes on the 4th cacheline that are not being used, > right? Well, even better then! > > One other observation is that maybe we could do it as the 'struct sock' > hierachy in networking, where we would have a 'struct exec_file' that > would be: > > struct exec_file { > struct file file; > char build_id[20]; > } > > say, and then when we create the 'struct file' in __alloc_file() we > could check some bit in 'flags' like Al Viro suggested and pick a > different slab than 'filp_cachep', that has that extra space for the > build_id (and whatever else exec related state we may end up wanting, if > ever). > > No core fs will need to know about that except when we go free it, to > free from the right slab cache. > > In current distro configs, no overhead would take place if I read that > SLAB_HWCACHE_ALIGN thing right, no? Makes sense to me as well. Whatever the solution, as long as it's usable from NMI contexts would be fine for the purposes of fetching build ID. It would be good to hear from folks that are opposing adding a pointer field to struct file whether they prefer this way instead? > > - Arnaldo