From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751839AbdFTQiT (ORCPT ); Tue, 20 Jun 2017 12:38:19 -0400 Received: from foss.arm.com ([217.140.101.70]:41820 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751040AbdFTQiS (ORCPT ); Tue, 20 Jun 2017 12:38:18 -0400 Date: Tue, 20 Jun 2017 17:37:28 +0100 From: Mark Rutland To: Alexey Budankov Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Andi Kleen , Kan Liang , Dmitri Prokhorov , Valery Cherepennikov , David Carrillo-Cisneros , Stephane Eranian , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/n] perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi Message-ID: <20170620163728.GC26710@leverpostej> References: <09226446-39b9-9bd2-d60f-b9bb947987c5@linux.intel.com> <20170615195618.GA8807@leverpostej> <162b1822-06b7-30e0-073c-911ba99b33b7@linux.intel.com> <20170620133624.GF28157@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 20, 2017 at 06:22:56PM +0300, Alexey Budankov wrote: > On 20.06.2017 16:36, Mark Rutland wrote: > >On Mon, Jun 19, 2017 at 11:31:59PM +0300, Alexey Budankov wrote: > >>On 15.06.2017 22:56, Mark Rutland wrote: > >>>On Thu, Jun 15, 2017 at 08:41:42PM +0300, Alexey Budankov wrote: > >>>>+static int > >>>>+perf_cpu_tree_iterate(struct rb_root *tree, > >>>>+ perf_cpu_tree_callback_t callback, void *data) > >>>>+{ > >>>>+ int ret = 0; > >>>>+ struct rb_node *node; > >>>>+ struct perf_event *event; > >>>>+ > >>>>+ WARN_ON_ONCE(!tree); > >>>>+ > >>>>+ for (node = rb_first(tree); node; node = rb_next(node)) { > >>>>+ struct perf_event *node_event = container_of(node, > >>>>+ struct perf_event, group_node); > >>>>+ > >>>>+ list_for_each_entry(event, &node_event->group_list, > >>>>+ group_list_entry) { > >>>>+ ret = callback(event, data); > >>>>+ if (ret) > >>>>+ return ret; > >>>>+ } > >>>>+ } > >>>>+ > >>>>+ return 0; > >>>> } > >>> > >>>If you need to iterate over every event, you can use the list that > >>>threads the whole tree. > >> > >>Could you please explain more on that? > > > >In Peter's original suggestion, we'd use a threaded tree rather than a > >tree of lists. > > > >i.e. you'd have something like: > > > >struct threaded_rb_node { > > struct rb_node node; > > struct list_head head; > >}; > > Is this for every group leader? Yes; *every* group leader would be directly in the threaded rb tree. > Which objects does the head keep? Sorry, I'm not sure how to answer that. Did the above clarify? If not, could you rephrase the question? Thanks, Mark.