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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59912C54EE9 for ; Thu, 22 Sep 2022 14:48:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231989AbiIVOsx (ORCPT ); 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> 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?