Re: [PATCH] Reduce stack usage in acct.c
From: Olaf Dietsche
Date: Sun Apr 03 2005 - 06:38:11 EST
Yum Rayan <yum.rayan@xxxxxxxxx> 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@xxxxxxxxx>
>
> --- 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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/