Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932194AbWCUGgb (ORCPT ); Tue, 21 Mar 2006 01:36:31 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751191AbWCUGga (ORCPT ); Tue, 21 Mar 2006 01:36:30 -0500 Received: from willy.net1.nerim.net ([62.212.114.60]:23819 "EHLO willy.net1.nerim.net") by vger.kernel.org with ESMTP id S1750719AbWCUGga (ORCPT ); Tue, 21 Mar 2006 01:36:30 -0500 Date: Tue, 21 Mar 2006 07:32:52 +0100 From: Willy Tarreau To: Linus Torvalds Cc: Andrew Morton , kernel-stuff@comcast.net, linux-kernel@vger.kernel.org, alex-kernel@digriz.org.uk, jun.nakajima@intel.com, davej@redhat.com, viro@ftp.linux.org.uk Subject: Re: OOPS: 2.6.16-rc6 cpufreq_conservative Message-ID: <20060321063252.GA24614@w.ods.org> References: <200603181525.14127.kernel-stuff@comcast.net> <20060318165302.62851448.akpm@osdl.org> <20060320061212.GG21493@w.ods.org> <20060320071846.GA19642@w.ods.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060320071846.GA19642@w.ods.org> User-Agent: Mutt/1.5.10i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2081 Lines: 59 On Mon, Mar 20, 2006 at 08:18:46AM +0100, Willy Tarreau wrote: > On Sun, Mar 19, 2006 at 10:26:30PM -0800, Linus Torvalds wrote: > > > > > > On Mon, 20 Mar 2006, Willy Tarreau wrote: > > > > > > Now, does removing the macro completely change the output code ? > > > I think that if something written like this produces the same > > > code, it would be easier to read : > > > > > > #define for_each_cpu_mask(cpu, mask) \ > > > for ((cpu) = 0; (cpu) < NR_CPUS; (cpu)++) { \ > > > unsigned long __bits = (mask).bits[0] >> (cpu); \ > > > if (!__bits) \ > > > break; \ > > > if (!__bits & 1) \ > > > continue; \ > > > else > > > > Absolutely, but now it has a dangling "{" that didn't get closed. So the > > above would definitely be more readable, it just doesn't actually work. > > > > Unless you'd do the "end_for_each_cpu" define (to close the statement), > > and update the 300+ places that use this. Which might well be worth it. > > > > So the subtle "break from the middle of a statement expression" was just a > > rather hacky way to avoid having to change all the users of this macro. > > > > Linus > > Oh, you're right, now I understand your motivation in doing this. > Then perhaps using your trick but applying it to the whole for loop > would make it easier to read ? > > #define for_each_cpu_mask(cpu, mask) \ > for ((cpu) = 0; (cpu) < NR_CPUS; (cpu)++) \ > ({ unsigned long __bits = (mask).bits[0] >> (cpu); \ > if (!__bits) \ > break; \ > if (!__bits & 1) \ > continue; \ > else \ > ... \ > }) Well, forget it ! I did not realize that the 'else' was what called the inner loop. So this construct it not possible at all either for the same reason. Sorry for not having read the code before posting. Cheers, Willy - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/