From: Daniel Walker <dwalker@fifo99.com>
To: Cesar Eduardo Barros <cesarb@cesarb.net>
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 09:52:16 -0700 [thread overview]
Message-ID: <1254070336.20648.518.camel@desktop> (raw)
In-Reply-To: <4ABF8B30.5050801@cesarb.net>
On Sun, 2009-09-27 at 12:56 -0300, Cesar Eduardo Barros wrote:
> Daniel Walker escreveu:
> > On Sun, 2009-09-27 at 10:53 -0300, Cesar Eduardo Barros wrote:
> >> #define
> >> WARN_ON_ONCE(condition) ({ \
> >> - static int __warned; \
> >> + static bool __warned; \
> >> int __ret_warn_once = !!(condition); \
> >
> > Could __ret_warn_once be bool also ? It looks like just another
> > conditional variable..
>
> Yes, it could (as long as either it is converted back to int in the
> return of the macro, or all users do not care about the macro's return
> type). However, the justification used for the printk_once patch (and
> this WARN_ONCE patch) does not apply directly anymore, since the code is
> different (to start with, it is not a static variable).
I did a couple kernel builds to test this on a small normal config,
vmlinux.base-line
text data bss dec hex filename
6718958 497200 1082460 8298618 7ea07a vmlinux.base-line
vmlinux.one-bool <-- Your patch
text data bss dec hex filename
6718590 497232 1082292 8298114 7e9e82 vmlinux.one-bool
vmlinux.all-bool-converted
text data bss dec hex filename
6718506 497232 1082292 8298030 7e9e2e vmlinux.all-converted
your changes drops the size 368 bytes, and if you convert the other
conditionals it drops it by another 84 bytes. Not much more, but it's
something.
So I think Rolands original reasoning still holds.. As far as people
needing an int output from WARN_ON() , I'm not sure that's happening
anyplace .. I can't imagine a sane usage for that..
Daniel
next prev parent reply other threads:[~2009-09-27 16:52 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 [this message]
2009-09-27 17:24 ` Cesar Eduardo Barros
2009-09-27 17:32 ` Daniel Walker
2009-09-27 17:48 ` Cesar Eduardo Barros
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=1254070336.20648.518.camel@desktop \
--to=dwalker@fifo99.com \
--cc=akpm@linux-foundation.org \
--cc=cesarb@cesarb.net \
--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 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.