Re: [BUG 2.6.20-rc2-mm1] init segfaults whenCONFIG_PROFILE_LIKELY=y

From: Hua Zhong
Date: Tue Jan 02 2007 - 17:30:18 EST



I am wondering if we should define __likely/__unlikely macros no matter whether
CONFIG_LIKELY_PROFILE is defined, like the following. This way people can always
use the raw macros in case the debugging version causes problems.

Signed-off-by: Hua Zhong <hzhong@xxxxxxxxx>

--- linux-2.6/include/linux/compiler.h.orig 2007-01-02 13:51:32.000000000 -0800
+++ linux-2.6/include/linux/compiler.h 2007-01-02 14:18:33.000000000 -0800
@@ -53,6 +53,9 @@
# include <linux/compiler-intel.h>
#endif

+#define __likely(x) __builtin_expect(!!(x), 1)
+#define __unlikely(x) __builtin_expect(!!(x), 0)
+
#if defined(CONFIG_PROFILE_LIKELY) && !(defined(CONFIG_MODULE_UNLOAD) && defined(MODULE))
struct likeliness {
const char *func;
@@ -93,8 +96,8 @@
* specific implementations come from the above header files
*/

-#define likely(x) __builtin_expect(!!(x), 1)
-#define unlikely(x) __builtin_expect(!!(x), 0)
+#define likely(x) __likely(x)
+#define unlikely(x) __unlikely(x)
#endif

/* Optimization barrier */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/