From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757125Ab0CJUrG (ORCPT ); Wed, 10 Mar 2010 15:47:06 -0500 Received: from bombadil.infradead.org ([18.85.46.34]:54095 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757005Ab0CJUrE convert rfc822-to-8bit (ORCPT ); Wed, 10 Mar 2010 15:47:04 -0500 Subject: Re: [RFC PATCH] perf: Store relevant events in a hlist From: Peter Zijlstra To: Frederic Weisbecker Cc: LKML , Ingo Molnar , Paul Mackerras , Steven Rostedt , Masami Hiramatsu , Jason Baron , Arnaldo Carvalho de Melo In-Reply-To: <20100310203338.GA9737@nowhere> References: <1267772426-5944-1-git-send-regression-fweisbec@gmail.com> <1267772426-5944-2-git-send-regression-fweisbec@gmail.com> <1267781969.16716.55.camel@laptop> <20100308183545.GA5038@nowhere> <1268249692.5279.138.camel@twins> <20100310203338.GA9737@nowhere> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Date: Wed, 10 Mar 2010 21:46:40 +0100 Message-ID: <1268254000.5279.167.camel@twins> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2010-03-10 at 21:33 +0100, Frederic Weisbecker wrote: > On Wed, Mar 10, 2010 at 08:34:52PM +0100, Peter Zijlstra wrote: > > I'm not quite sure why you need the node thing, you already have a > > hash-bucket to iterate, simply stick all events into the one bucket and > > walk through it with a filter and process all events that match. > > > This inter level of indirection was one of my heaviest hesitations. > In case we have a hash collision, I just wanted to ensure we keep > an amortized O(n) in any case, that at the cost of this level of > indirection. Plus that removed the config:id check in every events, > as the check is made only once. > > That said I guess we can indeed remove that and have the events > directly in the hash bucket. Assuming we deal well to avoid > collisions, it should be fine. Right, lets start simple and go from there. > > As to all those for_each_online_cpu() thingies, it might make sense to > > also have a global hash-table for events active on all cpus,... hmm was > > that the reason for the node thing, one event cannot be in multiple > > buckets? > > > There are several reasons I've made it per cpu. > Assuming we have a global hash table for wide events, it means we'll > have some cache dance each time an event is disabled/enabled (which > is quite often as wide events are per task, even worst if the initial task > has numerous threads that have this event duplicated). Also, as wide > events mean per task, the event will always be active in one cpu at > a time, it would be wasteful to check it on other cpus. Thing is, most events generated by perf are per cpu, even the per task ones, if they are machine wide the hash table bounces aren't the biggest problem. But yeah..