From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S263972AbUGMHoO (ORCPT ); Tue, 13 Jul 2004 03:44:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S264054AbUGMHoO (ORCPT ); Tue, 13 Jul 2004 03:44:14 -0400 Received: from cantor.suse.de ([195.135.220.2]:47584 "EHLO Cantor.suse.de") by vger.kernel.org with ESMTP id S263972AbUGMHoA (ORCPT ); Tue, 13 Jul 2004 03:44:00 -0400 Date: Tue, 13 Jul 2004 09:43:59 +0200 Message-ID: From: Takashi Iwai To: Andrea Arcangeli Cc: Christoph Hellwig , Ingo Molnar , linux-kernel@vger.kernel.org, Arjan van de Ven Subject: Re: [announce] [patch] Voluntary Kernel Preemption Patch In-Reply-To: <20040712193606.GP20947@dualathlon.random> References: <20040709182638.GA11310@elte.hu> <20040709195105.GA4807@infradead.org> <20040709235017.GP20947@dualathlon.random> <20040710005208.GW20947@dualathlon.random> <20040712193606.GP20947@dualathlon.random> User-Agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 MULE XEmacs/21.4 (patch 15) (Security Through Obscurity) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org At Mon, 12 Jul 2004 21:36:06 +0200, Andrea Arcangeli wrote: > > On Mon, Jul 12, 2004 at 12:17:05PM +0200, Takashi Iwai wrote: > > Couldn't it be simply written like below? > > > > #define BUILD_BUG_ON(condition) do { if (unlikely(condition)) BUILD_BUG(); } while(0) > > BUILD_BUG_ON is a different thing. the "condition" is meant to be > evaluated at _compile_ time, not at runtime (so the unlikely is useless > since the compiler knows the result before it generates the bytecode). > This is why BUILD_BUG() isn't implemented anywhere, so you get a linker > error during the compilation. > > For example with it you can do things like: > > BUILD_BUG_ON(offsetof(struct task_struct, thread.i387.fxsave) & 15); > > (see asm-i386/bugs.h, it's doing the BUILD_BUG_ON by hand right now) Yes, sorry for confusing, copy & paste from a wrong place. I'm just wondering whether '!=0' is needed inside unlikely() as defined in asm-i386/bug.h: #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0) Without '!= 0', it's expanded identically as you wrote. Well, the compiler may get rid of it after optimization... BTW, BUG_ON(a||b) is a different story, of course :) Takashi