From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933790Ab1ESSG4 (ORCPT ); Thu, 19 May 2011 14:06:56 -0400 Received: from mx3.mail.elte.hu ([157.181.1.138]:43911 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933638Ab1ESSGz (ORCPT ); Thu, 19 May 2011 14:06:55 -0400 Date: Thu, 19 May 2011 20:06:50 +0200 From: Ingo Molnar To: Peter Zijlstra Cc: Robert Richter , Stephane Eranian , LKML Subject: Re: [PATCH v2] perf, x86: Fix event scheduler for constraints with overlapping counters Message-ID: <20110519180650.GC6139@elte.hu> References: <1302913676-14352-1-git-send-email-robert.richter@amd.com> <1302913676-14352-5-git-send-email-robert.richter@amd.com> <20110419102600.GU31407@erda.amd.com> <1305753398.2466.7180.camel@twins> <20110518212054.GC28476@elte.hu> <1305754613.2466.7190.camel@twins> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1305754613.2466.7190.camel@twins> User-Agent: Mutt/1.5.20 (2009-08-17) X-ELTE-SpamScore: -2.0 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-2.0 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.3.1 -2.0 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Peter Zijlstra wrote: > On Wed, 2011-05-18 at 23:20 +0200, Ingo Molnar wrote: > > * Peter Zijlstra wrote: > > > > > > if (c->weight != w) > > > > continue; > > > > > > > > - for_each_set_bit(j, c->idxmsk, X86_PMC_IDX_MAX) { > > > > - if (!test_bit(j, used_mask)) > > > > + /* for each bit in idxmsk starting from idx */ > > > > + while (idx < X86_PMC_IDX_MAX) { > > > > + idx = find_next_bit(c->idxmsk, X86_PMC_IDX_MAX, > > > > + idx); > > > > > > I'd be mighty tempted to ignore that 80 column rule here ;-) > > > > Please put the body of the loop into a helper function, the function is large > > and there are countless col80 uglinesses in it! > > I just tried that, its real ugly due to the amount of state you need to > pass around. Does it help if you put that state into a helper structure? Thanks, Ingo