From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752071AbdGRNjm (ORCPT ); Tue, 18 Jul 2017 09:39:42 -0400 Received: from mga07.intel.com ([134.134.136.100]:6519 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751445AbdGRNjl (ORCPT ); Tue, 18 Jul 2017 09:39:41 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,378,1496127600"; d="scan'208";a="126464305" Subject: Re: [PATCH v5 1/4]: perf/core: use rb trees for pinned/flexible groups To: Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo Cc: Andi Kleen , Kan Liang , Dmitri Prokhorov , Valery Cherepennikov , Mark Rutland , David Carrillo-Cisneros , Stephane Eranian , linux-kernel References: <874luavsh5.fsf@ashishki-desk.ger.corp.intel.com> From: Alexey Budankov Organization: Intel Corp. Message-ID: <00247f4a-1637-b7fe-2408-07330fcb3171@linux.intel.com> Date: Tue, 18 Jul 2017 16:39:36 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <874luavsh5.fsf@ashishki-desk.ger.corp.intel.com> Content-Type: text/plain; charset=utf-8 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 Hi, On 18.07.2017 15:29, Alexander Shishkin wrote: > Alexey Budankov writes: > >> +/* >> + * Helper function to test if event groups are empty; >> + */ >> +static int >> +perf_event_groups_empty(struct perf_event_groups *groups) >> +{ >> + return list_empty(&groups->list); >> +} > > This doesn't seem useful, it's only used once. Also, it's not clear how > access to groups->list is serialized here, but it is in the caller. Acepted. That API is removed in the final patch where list is replaced by rbtree. > > I'm assuming you will use this helper after the linked lists are done > away with, but I'll have to go fishing for that patch to make sure. > >> +static void >> +perf_event_groups_insert(struct perf_event_groups *groups, >> + struct perf_event *event) >> +{ >> + struct rb_node **node; >> + struct rb_node *parent; >> + struct perf_event *node_event; >> + >> + WARN_ON_ONCE(!groups || !event); > > I'm pretty sure neither of these is plausible. Used that for debugging. Does it affect performance somehow? > >> + WARN_ON_ONCE(!list_empty(&event->group_list_entry)); > > So ctx::lock is held here, right? That could be a useful assert and/or > comment at least for review purposes. Now I see that it's called from > list_add_event(). Agree. > > Regards, > -- > Alex > Thanks, Alexey