Re: [patch 1/2] move WARN_ON() out of line

From: Olof Johansson
Date: Fri Jan 04 2008 - 11:18:58 EST


Hi,

On Thu, Jan 03, 2008 at 10:26:05PM +0100, Arjan van de Ven wrote:

> This patch build on top of Olof's patch that introduces __WARN,
> and places the slowpath out of line. It also uses Ingo's suggestion
> to not use __FUNCTION__ but to use kallsyms to do the lookup;
> this saves a ton of extra space since gcc doesn't need to store the function
> string twice now:
>
> 3936367 833603 624736 5394706 525112 vmlinux.before
> 3917508 833603 624736 5375847 520767 vmlinux-slowpath
>
> 15Kb savings...

This patch actually resulted in a slight size increase on PPC, most
likely because of the new warn_on_slowpath() that isn't used:

text data bss dec hex filename
8059224 1820584 529064 10408872 9ed3a8 vmlinux.mainline
8058268 1820592 529064 10407924 9ecff4 vmlinux.mm
8058324 1820648 529064 10408036 9ed064 vmlinux.mm+arjanpatch

Also:

> Index: linux-2.6.24-rc6/include/asm-generic/bug.h
> ===================================================================
> --- linux-2.6.24-rc6.orig/include/asm-generic/bug.h
> +++ linux-2.6.24-rc6/include/asm-generic/bug.h
> @@ -32,11 +32,8 @@ struct bug_entry {
> #endif
>
> #ifndef __WARN
> -#define __WARN() do { \
> - printk("WARNING: at %s:%d %s()\n", __FILE__, \
> - __LINE__, __FUNCTION__); \
> - dump_stack(); \
> -} while (0)
> +extern void warn_on_slowpath(const char *file, const int line);
> +#define __WARN() warn_on_slowpath(__FILE__, __LINE__)
> #endif
>

This caused problems on powerpc, since bug.h ends up being pulled into
some assembly files. The #defines in there have been fine, but the
external declaration threw it off. (They need them to get to some of the
include/asm-powerpc/bug.h contents, but it pulls in the generic one as
well).

Easiest is probably to encapsulate the whole file in #ifndef __ASSEMBLY__.


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