mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] exportfs: reduce stack usage
@ 2004-09-29  4:57 Randy.Dunlap
  2004-10-01  1:12 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Randy.Dunlap @ 2004-09-29  4:57 UTC (permalink / raw)
  To: lkml; +Cc: neilb


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);


--

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] exportfs: reduce stack usage
  2004-09-29  4:57 [PATCH] exportfs: reduce stack usage Randy.Dunlap
@ 2004-10-01  1:12 ` Neil Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2004-10-01  1:12 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: lkml

On Tuesday September 28, rddunlap@osdl.org wrote:
> 
> 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.

So it does.  I thought gcc was cleverer than that.
I'll add it to my collection.

Thanks,
NeilBrown

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-10-01  1:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-29  4:57 [PATCH] exportfs: reduce stack usage Randy.Dunlap
2004-10-01  1:12 ` Neil Brown

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®