From: "Sergio Luis" <eeeesti@gmail.com>
To: "Rakib Mullick" <rakib.mullick@gmail.com>
Cc: "Linux-kernel Mailing List" <linux-kernel@vger.kernel.org>,
mingo@elte.hu, akpm@linux-foundation.org
Subject: Re: [PATCH] init: Reduce text space by removing a variable.
Date: Mon, 12 Jan 2009 03:43:10 -0300 [thread overview]
Message-ID: <ce0170d90901112243y2cd6fee1pc7405cee04a52ecc@mail.gmail.com> (raw)
In-Reply-To: <b9df5fa10901112157j449d104fm1a1281a6bef409f9@mail.gmail.com>
On Mon, Jan 12, 2009 at 2:57 AM, Rakib Mullick <rakib.mullick@gmail.com> wrote:
> Impact: Reduce some text space.
>
> We can carryout the function 'raid_setup' without the variable 'len'
> and using a bit compiler optimization. Which also removes 8 bytes of
> text space on my x86 system.
>
> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
>
> --- linux-2.6-orig/init/do_mounts_md.c 2009-01-12 09:53:09.000000000 +0600
> +++ linux-2.6/init/do_mounts_md.c 2009-01-12 11:12:39.734543784 +0600
> @@ -243,17 +243,17 @@ static void __init md_setup_drive(void)
>
> static int __init raid_setup(char *str)
> {
> - int len, pos;
> + int pos;
>
> - len = strlen(str) + 1;
> pos = 0;
>
> - while (pos < len) {
> + while (pos < strlen(str) + 1) {
doesn't calling strlen for every iteration (and in the else statement)
add an unneeded (and unwanted) overhead?
> char *comma = strchr(str+pos, ',');
> int wlen;
> if (comma)
> wlen = (comma-str)-pos;
> - else wlen = (len-1)-pos;
> + else
> + wlen = strlen(str)-pos;
>
> if (!strncmp(str, "noautodetect", wlen))
> raid_noautodetect = 1;
> --
Sergio.
prev parent reply other threads:[~2009-01-12 6:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-12 5:57 Rakib Mullick
2009-01-12 6:43 ` Sergio Luis [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=ce0170d90901112243y2cd6fee1pc7405cee04a52ecc@mail.gmail.com \
--to=eeeesti@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rakib.mullick@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®