Re: [patch] 2.5.9 remove warnings

Andrew Morton (akpm@zip.com.au)
Tue, 23 Apr 2002 11:32:15 -0700


Keith Owens wrote:
>
> ...
> @@ -47,7 +47,7 @@ static inline void __unhash_process(stru
> spin_unlock(&dcache_lock);
> }
> write_unlock_irq(&tasklist_lock);
> - if (unlikely(proc_dentry)) {
> + if (unlikely(proc_dentry != NULL)) {
> shrink_dcache_parent(proc_dentry);
> dput(proc_dentry);
> }

Is it not possible to fix it for all time?

--- linux-2.5.9/include/linux/compiler.h Sun Apr 14 15:45:08 2002
+++ 25/include/linux/compiler.h Tue Apr 23 11:27:37 2002
@@ -10,8 +10,8 @@
#define __builtin_expect(x, expected_value) (x)
#endif

-#define likely(x) __builtin_expect((x),1)
-#define unlikely(x) __builtin_expect((x),0)
+#define likely(x) __builtin_expect((x) != 0, 1)
+#define unlikely(x) __builtin_expect((x) != 0, 0)

/* This macro obfuscates arithmetic on a variable address so that gcc
shouldn't recognize the original var, and make assumptions about it */

(Interestingly, this patch shrinks my kernel by 32 bytes. hmm.)

BTW, it would be very useful if someone could invert the sense of
`likely' and `unlikely', so they always say the *wrong* thing, and
then actually demonstrate some real-world slowdown. coz if this
can't be done, why are we putting up with the visual clutter?

-
-
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/