mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: neilb@cse.unsw.edu.au
Subject: [PATCH] exportfs: reduce stack usage
Date: Tue, 28 Sep 2004 21:57:18 -0700	[thread overview]
Message-ID: <20040928215718.55ed72a5.rddunlap@osdl.org> (raw)


find_exported_dentry() declares
	char nbuf[NAME_MAX+1];
in 2 separate places, and gcc allocates space on the stack for both
of them.  Having just one of them will suffice, if we can put put
with its scope.

Reduces function stack usage on x86-32 from 0x230 to 0x130.

Signed-off-by: Randy Dunlap <rddunlap@osdl.org>


diffstat:=
 fs/exportfs/expfs.c |    4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)

diff -Naurp ./fs/exportfs/expfs.c~expfs_stack ./fs/exportfs/expfs.c
--- ./fs/exportfs/expfs.c~expfs_stack	2004-09-15 19:27:42.000000000 -0700
+++ ./fs/exportfs/expfs.c	2004-09-28 21:35:42.339816784 -0700
@@ -55,7 +55,7 @@ find_exported_dentry(struct super_block 
 	struct list_head *le, *head;
 	struct dentry *toput = NULL;
 	int noprogress;
-
+	char nbuf[NAME_MAX+1];
 
 	/*
 	 * Attempt to find the inode.
@@ -176,7 +176,6 @@ find_exported_dentry(struct super_block 
 			 */
 			struct dentry *ppd;
 			struct dentry *npd;
-			char nbuf[NAME_MAX+1];
 
 			down(&pd->d_inode->i_sem);
 			ppd = CALL(nops,get_parent)(pd);
@@ -241,7 +240,6 @@ find_exported_dentry(struct super_block 
 	/* if we weren't after a directory, have one more step to go */
 	if (result != target_dir) {
 		struct dentry *nresult;
-		char nbuf[NAME_MAX+1];
 		err = CALL(nops,get_name)(target_dir, nbuf, result);
 		if (!err) {
 			down(&target_dir->d_inode->i_sem);


--

             reply	other threads:[~2004-09-29  4:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-29  4:57 Randy.Dunlap [this message]
2004-10-01  1:12 ` Neil Brown

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=20040928215718.55ed72a5.rddunlap@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@cse.unsw.edu.au \
    /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®