From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751090AbdE2PXB (ORCPT ); Mon, 29 May 2017 11:23:01 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:46224 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750811AbdE2PXA (ORCPT ); Mon, 29 May 2017 11:23:00 -0400 Date: Mon, 29 May 2017 17:22:54 +0200 From: Peter Zijlstra To: Alexey Budankov Cc: Alexander Shishkin , Ingo Molnar , Arnaldo Carvalho de Melo , Andi Kleen , Kan Liang , Dmitri Prokhorov , Valery Cherepennikov , David Carrillo-Cisneros , Stephane Eranian , Mark Rutland , linux-kernel@vger.kernel.org Subject: Re: [PATCH]: perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi Message-ID: <20170529152254.wjx3b6apmatcso77@hirez.programming.kicks-ass.net> References: <1e962b59-3e39-e0d6-515d-c4fd3502edae@linux.intel.com> <87k24zzx7s.fsf@ashishki-desk.ger.corp.intel.com> <47dc6d8d-77db-70f5-9aa6-2aca38590e60@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47dc6d8d-77db-70f5-9aa6-2aca38590e60@linux.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 29, 2017 at 04:43:09PM +0300, Alexey Budankov wrote: > On 29.05.2017 15:03, Alexander Shishkin wrote: > > Alexey Budankov writes: > > > + } else if (event->cpu > node_event->cpu) { > > > + node = &((*node)->rb_right); > > > + } else { > > > + list_add_tail(&event->group_list_entry, > > > + &node_event->group_list); > > > > So why is this better than simply having per-cpu event lists plus one > > for per-thread events? > > Good question. Choice of data structure and layout depends on the operations > applied to the data so keeping groups as a tree simplifies and improves the > implementation in terms of scalability and performance. Please ask more if > any. Since these lists are per context, and each task can have a context, you'd end up with per-task-per-cpu memory, which is something we'd like to avoid (some archs have very limited per-cpu memory space etc..). Also, we'd like to have that tree for other reasons, like for instance that heterogeneous PMU crud ARM has. Also, with a tree we can easier do time based round-robin scheduling,