Re: [PATCH] Reduce stack usage in acct.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yum Rayan <[email protected]> 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 <[email protected]>
>
> --- 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux