From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753996AbdFPOId (ORCPT ); Fri, 16 Jun 2017 10:08:33 -0400 Received: from mga11.intel.com ([192.55.52.93]:14713 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753678AbdFPOIc (ORCPT ); Fri, 16 Jun 2017 10:08:32 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,347,1493708400"; d="scan'208";a="115277467" Subject: Re: [PATCH v3 1/n] perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi To: Mark Rutland 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 References: <09226446-39b9-9bd2-d60f-b9bb947987c5@linux.intel.com> <20170615195618.GA8807@leverpostej> <07a76338-4c71-569a-d36e-7d6bcd10bd74@linux.intel.com> <20170616090938.GB20092@leverpostej> From: Alexey Budankov Organization: Intel Corp. Message-ID: Date: Fri, 16 Jun 2017 17:08:27 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170616090938.GB20092@leverpostej> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.06.2017 12:09, Mark Rutland wrote: > On Fri, Jun 16, 2017 at 01:10:10AM +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: >>>> This series of patches continues v2 and addresses captured comments. > >>>> Specifically this patch replaces pinned_groups and flexible_groups >>>> lists of perf_event_context by red-black cpu indexed trees avoiding >>>> data structures duplication and introducing possibility to iterate >>>> event groups for a specific CPU only. >>> >>> If you use --per-thread, I take it the overhead is significantly >>> lowered? >> >> Please ask more. > > IIUC, you're seeing the slowdown when using perf record, correct? Correct. Specifically in per-process mode - without -a option. > > There's a --per-thread option to ask perf record to not duplicate the > event per-cpu. > > If you use that, what amount of slowdown do you see? > > It might be preferable to not open task-bound per-cpu events on systems > with large cpu counts, and it would be good to know what the trade-off > looks like for this case. > >>>> +static void >>>> +perf_cpu_tree_insert(struct rb_root *tree, struct perf_event *event) >>>> +{ >>>> + struct rb_node **node; >>>> + struct rb_node *parent; >>>> + >>>> + WARN_ON_ONCE(!tree || !event); >>>> + >>>> + node = &tree->rb_node; >>>> + parent = *node; >>> >>> The first iteration of the loop handles this, so it can go. >> >> If tree is empty parent will be uninitialized what is harmful. > > Sorry; my bad. > > Thanks, > Mark. >