From: Thiago Galesi <thiagogalesi@gmail.com>
To: Will Newton <will.newton@gmail.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crc32: remove useless __pure modifier from functions
Date: Tue, 3 Mar 2009 10:17:30 -0300 [thread overview]
Message-ID: <82ecf08e0903030517r49367e42ybf21e0020f35f6ce@mail.gmail.com> (raw)
In-Reply-To: <87a5b0800903030133y7bd22204y4995657cfd75950f@mail.gmail.com>
>
> Did you see any change in size of your kernel with this annotation? It
> didn't seem to have any effect as far as I could tell.
No, because I didn't test it with the kernel. Anyway, probably size
won't change a lot.
What the compiler does is: if (you're saying) it's a pure function,
and it has been called previously with the same parameters, the return
value is identical, hence, the compiler doesn't need to call the
function again.
Here's the test I did http://duskblue.org/pure_test.tar.gz Pretty
straighforward, but you have to 'make CFLAGS=-O1' to make the
optimization work.
>
> There are a number of functions in lib/ code that could be marked
> __pure or __attribute_const__ but I'm not sure if it's worth the
> effort, for my compiler (gcc 4.2) at least.
>
What const does is similar: it indicates that the function will not
change parameters marked with __const, so it will not need to reload
them after the function is called.
--
-
Thiago Galesi
prev parent reply other threads:[~2009-03-03 13:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-02 15:18 Pekka Enberg
2009-03-02 15:50 ` Thiago Galesi
2009-03-02 17:28 ` Pekka Enberg
2009-03-02 17:42 ` Thiago Galesi
2009-03-03 9:33 ` Will Newton
2009-03-03 13:17 ` Thiago Galesi [this message]
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=82ecf08e0903030517r49367e42ybf21e0020f35f6ce@mail.gmail.com \
--to=thiagogalesi@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
--cc=will.newton@gmail.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
all inboxes | Powered by JetHome®