From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Fabian Frederick <fabf@skynet.be>,
linux-kernel <linux-kernel@vger.kernel.org>,
Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: Re: [PATCH 1/1] kernel/profile.c: use static const char instead of static char
Date: Wed, 07 May 2014 15:35:35 -0700 [thread overview]
Message-ID: <1399502135.6345.8.camel@joe-AO725> (raw)
In-Reply-To: <20140507153050.70ad69194684f452bacc9bc8@linux-foundation.org>
On Wed, 2014-05-07 at 15:30 -0700, Andrew Morton wrote:
> On Wed, 7 May 2014 22:35:08 +0200 Fabian Frederick <fabf@skynet.be> wrote:
> > schedstr, sleepstr and kvmstr are only used in strcmp & strlen
[]
> > +++ b/kernel/profile.c
> > @@ -52,9 +52,9 @@ static DEFINE_MUTEX(profile_flip_mutex);
> >
> > int profile_setup(char *str)
> > {
> > - static char schedstr[] = "schedule";
> > - static char sleepstr[] = "sleep";
> > - static char kvmstr[] = "kvm";
> > + static const char schedstr[] = "schedule";
> > + static const char sleepstr[] = "sleep";
> > + static const char kvmstr[] = "kvm";
> > int par;
> >
>
> I'd expect this to either make no change or to make text larger and
> data smaller.
>
> In fact,
>
> text data bss dec hex filename
> 7631 811 3016 11458 2cc2 kernel/profile.o-before
> 7520 779 3016 11315 2c33 kernel/profile.o-after
>
> Both text and data got smaller and the total reduction was a whopping
> 143 bytes. Weirdness.
Now there's no code required to initialize/memcpy
the strings every function invocation.
prev parent reply other threads:[~2014-05-07 22:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-07 20:35 Fabian Frederick
2014-05-07 22:30 ` Andrew Morton
2014-05-07 22:35 ` Joe Perches [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=1399502135.6345.8.camel@joe-AO725 \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=fabf@skynet.be \
--cc=linux-kernel@vger.kernel.org \
--cc=paul.gortmaker@windriver.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®