From: Olaf Dietsche <olaf+list.linux-kernel@olafdietsche.de>
To: Yum Rayan <yum.rayan@gmail.com>
Cc: linux-kernel@vger.kernel.org, mvw@planets.elm.net
Subject: Re: [PATCH] Reduce stack usage in acct.c
Date: Sun, 03 Apr 2005 13:35:19 +0200 [thread overview]
Message-ID: <877jjkf5zc.fsf@goat.bogus.local> (raw)
In-Reply-To: <df35dfeb05033023394170d6cc@mail.gmail.com> (Yum Rayan's message of "Wed, 30 Mar 2005 23:39:40 -0800")
Yum Rayan <yum.rayan@gmail.com> writes:
> Attempt to reduce stack usage in acct.c (linux-2.6.12-rc1-mm3). Stack
> usage was noted using checkstack.pl. Specifically:
>
> Before patch
> ------------
> check_free_space - 128
>
> After patch
> -----------
> check_free_space - 36
>
> Signed-off-by: Yum Rayan <yum.rayan@gmail.com>
>
> --- a/kernel/acct.c 2005-03-25 22:11:06.000000000 -0800
> +++ b/kernel/acct.c 2005-03-30 15:33:05.000000000 -0800
> @@ -103,30 +103,32 @@
> */
> static int check_free_space(struct file *file)
> {
> - struct kstatfs sbuf;
> - int res;
> - int act;
> - sector_t resume;
> - sector_t suspend;
> + struct kstatfs *sbuf = NULL;
> + int res, act;
> + sector_t resume, suspend;
I can't see how you expect to save 128-36=92 bytes here. You replace
sizeof(struct kstatfs)=64 with sizeof(struct kstatfs*)=4, which would
be a saving of 60 bytes. But the call to kmalloc()/kfree() reduces
your stack saving further, not to mention the runtime penalty,
introduced by allocating dynamic memory.
Regards, Olaf.
prev parent reply other threads:[~2005-04-03 11:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-31 7:39 Yum Rayan
2005-03-31 15:05 ` Jörn Engel
2005-03-31 20:09 ` Randy.Dunlap
2005-03-31 20:40 ` Adrian Bunk
2005-03-31 20:30 ` Stack usage tasks Adrian Bunk
2005-03-31 20:43 ` Roland Dreier
2005-03-31 21:19 ` Adrian Bunk
2005-04-01 10:17 ` Jörn Engel
2005-04-01 11:16 ` Jörn Engel
2005-04-03 11:35 ` Olaf Dietsche [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=877jjkf5zc.fsf@goat.bogus.local \
--to=olaf+list.linux-kernel@olafdietsche.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mvw@planets.elm.net \
--cc=yum.rayan@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
Powered by JetHome