mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Fabian Frederick <fabf@skynet.be>
Cc: 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, 7 May 2014 15:30:50 -0700	[thread overview]
Message-ID: <20140507153050.70ad69194684f452bacc9bc8@linux-foundation.org> (raw)
In-Reply-To: <20140507223508.0fd3f59111f3d870859119fd@skynet.be>

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
> 
> ...
>
> --- a/kernel/profile.c
> +++ 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.


  reply	other threads:[~2014-05-07 22:30 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 [this message]
2014-05-07 22:35   ` Joe Perches

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=20140507153050.70ad69194684f452bacc9bc8@linux-foundation.org \
    --to=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®