From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753497AbbDBNpb (ORCPT ); Thu, 2 Apr 2015 09:45:31 -0400 Received: from casper.infradead.org ([85.118.1.10]:36425 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753258AbbDBNp2 (ORCPT ); Thu, 2 Apr 2015 09:45:28 -0400 Date: Thu, 2 Apr 2015 15:45:19 +0200 From: Peter Zijlstra To: Viresh Kumar Cc: Thomas Gleixner , Ingo Molnar , linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] hrtimer: create for_each_active_base() to iterate over active clock-bases Message-ID: <20150402134519.GA23123@twins.programming.kicks-ass.net> References: <909ec44dbfcc4898ecaf86f72e311f78756b21a8.1427959032.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <909ec44dbfcc4898ecaf86f72e311f78756b21a8.1427959032.git.viresh.kumar@linaro.org> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 02, 2015 at 04:21:22PM +0530, Viresh Kumar wrote: > +#define for_each_active_base(_index, _base, _cpu_base, _active_bases) \ > + for ((_active_bases) = (_cpu_base)->active_bases; \ > + (_index) = ffs(_active_bases), \ > + (_base) = (_cpu_base)->clock_base + (_index) - 1, (_index); \ > + (_active_bases) &= ~(1 << ((_index) - 1))) Can't use ffs here, some people end up using asm-generic/bitops/ffs.h and that sucks. Esp for small vectors like here, the unconditional iteration is faster.