public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cesar Eduardo Barros <cesarb@cesarb.net>
To: Daniel Walker <dwalker@fifo99.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Roland Dreier <rolandd@cisco.com>
Subject: Re: [PATCH] WARN_ONCE(): use bool for boolean flag
Date: Sun, 27 Sep 2009 14:48:51 -0300	[thread overview]
Message-ID: <4ABFA583.6030908@cesarb.net> (raw)
In-Reply-To: <1254072760.20648.524.camel@desktop>

Daniel Walker escreveu:
> On Sun, 2009-09-27 at 14:24 -0300, Cesar Eduardo Barros wrote:
> 
>> I took a quick look, and all uses seem to be directly in a boolean 
>> context (within an if()), so there would be no problem. Besides, the 
>> unlikely() all these macros end with does a double negation, meaning 
>> even if it is an int, it will be either 0 or 1 (but I am not sure I am 
>> reading these macros right - it seems CONFIG_TRACE_BRANCH_PROFILING 
>> turns all unlikely() into likely()).
>>
>> In fact, I was expecting no change at all, since gcc should be able to 
>> see it is being treated as a boolean (perhaps I am trusting gcc too 
>> much). And to make matters even more confusing, my own test changing all 
>> __ret_warn_once to bool and dropping the !! caused an _increase_ of 598 
>> bytes (x86-64 defconfig).
>>
>>     text    data     bss     dec     hex filename
>> 8100553 1207148  991988 10299689         9d2929 vmlinux.warnret.before
>> 8101119 1207180  991988 10300287         9d2b7f vmlinux.warnret.after
>>
>> (And yes, data increased again.)
> 
> Did you have the CONFIG_TRACE_BRANCH_PROFILING option enabled for the
> test above?

CONFIG_BRANCH_PROFILE_NONE=y

CONFIG_TRACE_BRANCH_PROFILING does not even appear in the .config.

> If this was just your regular base line config , then that is odd .. I
> also would think worse case would be no size reduction .. I did my
> compile test on x86-32 btw..

Yes, it is very odd. And I tried compiling a small test module to see if 
I could see the changes in the assembly output:

#include <linux/module.h>
#include <linux/kernel.h>

void test(int value)
{
         WARN_ON_ONCE(value);
}
EXPORT_SYMBOL_GPL(test);

But the assembly output is identical.

I will try looking at the first function which shows a difference in 
size (which appears to be handle_irq) and see what I can find.

-- 
Cesar Eduardo Barros
cesarb@cesarb.net
cesar.barros@gmail.com

  reply	other threads:[~2009-09-27 17:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-27 13:53 [PATCH] WARN_ONCE(): use bool for boolean flag Cesar Eduardo Barros
2009-09-27 14:03 ` Daniel Walker
2009-09-27 15:56   ` Cesar Eduardo Barros
2009-09-27 16:52     ` Daniel Walker
2009-09-27 17:24       ` Cesar Eduardo Barros
2009-09-27 17:32         ` Daniel Walker
2009-09-27 17:48           ` Cesar Eduardo Barros [this message]
2009-09-27 18:12             ` Cesar Eduardo Barros
2009-09-27 18:25               ` [PATCH] WARN_ONCE(): use bool for condition Cesar Eduardo Barros
2009-09-27 18:28                 ` Daniel Walker
2009-09-27 18:55                   ` Cesar Eduardo Barros
2009-09-27 19:03                     ` Daniel Walker
2009-09-29 20:59                 ` Andrew Morton
2009-09-29 23:11                   ` Cesar Eduardo Barros
2009-09-29 23:12                     ` [PATCH] WARN_ONCE(): use bool for boolean flag Cesar Eduardo Barros
2009-09-30  0:17                       ` Andrew Morton
2009-09-30  0:37                         ` Cesar Eduardo Barros
2009-09-29 23:18                     ` [PATCH] WARN_ONCE(): use bool for condition Cesar Eduardo Barros

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=4ABFA583.6030908@cesarb.net \
    --to=cesarb@cesarb.net \
    --cc=akpm@linux-foundation.org \
    --cc=dwalker@fifo99.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rolandd@cisco.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox