All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@linux.intel.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [patch 1/3] move WARN_ON() out of line
Date: Thu, 03 Jan 2008 17:22:30 +0100	[thread overview]
Message-ID: <477D0BC6.2060204@linux.intel.com> (raw)
In-Reply-To: <20080103092502.GA16096@elte.hu>

Ingo Molnar wrote:
> * Arjan van de Ven <arjan@linux.intel.com> 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...



  reply	other threads:[~2008-01-03 16:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-03  0:56 [patch 1/3] move WARN_ON() out of line Arjan van de Ven
2008-01-03  1:59 ` Matt Mackall
2008-01-03 21:06   ` Arjan van de Ven
2008-01-05  2:35     ` Herbert Xu
2008-01-05 18:33       ` Arjan van de Ven
2008-01-03  4:58 ` Olof Johansson
2008-01-03 21:03   ` Arjan van de Ven
2008-01-03  9:25 ` Ingo Molnar
2008-01-03 16:22   ` Arjan van de Ven [this message]
2008-01-05  6:42   ` Jeremy Fitzhardinge
2008-01-03 11:20 ` Pekka Enberg
2008-01-05  5:09 ` Dmitri Vorobiev
2008-01-05  6:41 ` Jeremy Fitzhardinge
2008-01-05 18:01   ` Arjan van de Ven
2008-01-05 18:08     ` Arjan van de Ven
2008-01-05 18:37       ` Arjan van de Ven
2008-01-05 18:45     ` Jeremy Fitzhardinge
2008-01-05 20:02       ` Arjan van de Ven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=477D0BC6.2060204@linux.intel.com \
    --to=arjan@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.