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

From: Arjan van de Ven
Date: Thu Jan 03 2008 - 11:24:34 EST


Ingo Molnar wrote:
* Arjan van de Ven <arjan@xxxxxxxxxxxxxxx> wrote:

+#define WARN_ON(condition) do_warn_on((unsigned long)(condition), __FILE__, \
+ __LINE__, __FUNCTION__)

hm. This passes in 4 arguments to do_warn_on().

i think we could get away with no arguments (!), by using section tricks. Firstly, we can get rid of __FUNCTION__ and replace it with a ksyms lookup - that is fine enough.

I can see that; I'll play with that

Secondly, we could put __FILE__ and __LINE__ into a text section and key it up to the return address from do_warn_on().

the asm generated for this is 2 movl instructions for immediate to register.
Doing fancy tricks ... it may well end up bigger and gain nothing.

the condition code should not be passed in at all i think - it creates extra function calls to do_warn_on() all the time.

function calls are *CHEAP*.

passing the condition is actually near free (remember we have regparm!), it's likely to be
in a register already anyway.

Doing the test inline makes stuff bigger, and also spreads the branch prediction pain around
rather than having one nicely predictable place...


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