Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp919746rwb; Thu, 22 Sep 2022 08:00:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM47qnhs96axhqRCnd35VTfBM2ztDFTIYmR7iL1Y3ayIBbXuyMZVm1NcIMc/ClYEY8frxZm2 X-Received: by 2002:aa7:8a49:0:b0:53e:6a9c:9a04 with SMTP id n9-20020aa78a49000000b0053e6a9c9a04mr4077763pfa.85.1663858833263; Thu, 22 Sep 2022 08:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663858833; cv=none; d=google.com; s=arc-20160816; b=H7QB1kDyR0QVDUjwLedV5h6ZdIe/YEISJ7kqNhwbsTF0ubYKznoafGP/xgBEndKNKv kKMHHo3rEbvP/0JiZ5htNN02ptuyiQV1JTAaY+/Ub0Y7dYC5vCEgBWydWsVUlieO4riY VSMSAtQEKd2ApSyNZbnk/XtNy8DIqnttkqgTz8NFiBCX7lndGjQ04epVAcmmRJ3iBa83 lLAyoLGCbGMfYr9Lw/a+2/36yKW05x+tGnWKEIc1htsEWNcw/6R6G9O2MN39sea/S88X za6If0Rl4Z4I+gIvZjW+Iqf0ogykFQfc6c9hgzNrNB1cFlS47zl3n9HYcESkyMHT4xyu F1Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lrHnKMPOzUeAyfSj/3BoDegtk/niQrwVfh0GEj+d7Uc=; b=vRCl/SfDTwCzSOqZe8k+Bf8KYV/Mk42ckdEElNT3RHbC4/10CSCrrwV7t3tf57X6ew yFbyOR62cr6Wlap8Eq/qL6s4yeC6MCFdIxj8TBqnD4zUybToei6u3Qwfe1Gtgcf5M2gK 7R/nBJET7PwkDDqFJozE0F3ZKdfg4pX1krjiVhFeZb3wtN5ex+O6UUpSyj3L8a+qwDj8 zZ+xF2oLZL9UW46Bi0c0f27rjKaKYPYf5+LsIqbd7+KDlmWh19zmHLkokJ0eoqLfX9d0 MhH8p5rD4QreNadjlOCOgq88Xs4DAwEWvqTfUkeFyNDDrFHaNFL7NgKlYD2itXVhIAKn x7WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=B1ZDODj1; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b20-20020a056a000a9400b0054342bb20e2si6515547pfl.66.2022.09.22.08.00.15; Thu, 22 Sep 2022 08:00:33 -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=@infradead.org header.s=desiato.20200630 header.b=B1ZDODj1; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231514AbiIVOsx (ORCPT + 99 others); Thu, 22 Sep 2022 10:48:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229911AbiIVOsv (ORCPT ); Thu, 22 Sep 2022 10:48:51 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE0377F11F for ; Thu, 22 Sep 2022 07:48:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=lrHnKMPOzUeAyfSj/3BoDegtk/niQrwVfh0GEj+d7Uc=; b=B1ZDODj11PNlMHBsJ7MXDwoMCv 4Z1tGWH9fyF4smjyjyJGGKDONjrpkLHP4+S2ztuz6YRK4TtvVC17mpiXjgxyYFfwU7bUzhl/dadYL eTGKTdspqtdeEY1wNHGZYhAPA7QLHTpbS+gbbd3r+iFYbi/nubFPtu1jjlbBNDceug0qO61tinb1o KQbJsIPK6WhjImKmu0WmpJdiOAsIRFe84Dy4zm+MfVB3YHZJGMGGBNNYJJiXlWw//3mduRYI9Ev0N jFWnnkbR2PLiH1Uqgnt7wDPJYcnGSTIo9xX5wbRsLNUrIS1Ly/elPOUgHgEuYjnShTKHbqqwzKT7w KyX3QgZA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1obNVD-00Eymr-Nn; Thu, 22 Sep 2022 14:48:36 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 8482D300169; Thu, 22 Sep 2022 16:48:34 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 68BF0203E5B5F; Thu, 22 Sep 2022 16:48:34 +0200 (CEST) Date: Thu, 22 Sep 2022 16:48:34 +0200 From: Peter Zijlstra To: Namhyung Kim Cc: Ingo Molnar , Mark Rutland , Alexander Shishkin , Arnaldo Carvalho de Melo , Jiri Olsa , LKML , Song Liu , Ravi Bangoria , Stephane Eranian , Kan Liang Subject: Re: [PATCH 1/2] perf: Use sample_flags for addr Message-ID: References: <20220921220032.2858517-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220921220032.2858517-1-namhyung@kernel.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 On Wed, Sep 21, 2022 at 03:00:31PM -0700, Namhyung Kim wrote: > Use the new sample_flags to indicate whether the addr field is filled by > the PMU driver. As most PMU drivers pass 0, it can set the flag only if > it has a non-zero value. And use 0 in perf_sample_output() if it's not > filled already. So no objection to the general idea; just a question > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h > index 368bdc4f563f..f4a13579b0e8 100644 > --- a/include/linux/perf_event.h > +++ b/include/linux/perf_event.h > @@ -1028,7 +1028,6 @@ struct perf_sample_data { > * minimize the cachelines touched. > */ > u64 sample_flags; > - u64 addr; > struct perf_raw_record *raw; > u64 period; > > @@ -1040,6 +1039,7 @@ struct perf_sample_data { > union perf_sample_weight weight; > union perf_mem_data_src data_src; > u64 txn; > + u64 addr; > > u64 type; > u64 ip; Is there a reason you placed the variable where you did? I'm thinking we should look at what perf-tool thinks is the common set of SAMPLE flags and make sure those fields are grouped in as little cachelines as possible. Things like @ip and @type, which are basically *always* set, should definitely be on top, no?