All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] slip_init and slirp_init using 12K of stack
@ 2006-01-17  0:26 Blaisorblade
  2006-01-17  3:41 ` Jeff Dike
  0 siblings, 1 reply; 3+ messages in thread
From: Blaisorblade @ 2006-01-17  0:26 UTC (permalink / raw)
  To: user-mode-linux-devel

I ran by accident scripts/checkstack.pl and found that slip_init and 
slirp_init are two big offenders.

They are since of such lines:

        *spri = ((struct slip_data)
                { .name         = { '\0' },
                  .addr         = NULL,
                  .gate_addr    = init->gate_addr,
                  .slave        = -1,
                  .slip         = SLIP_PROTO_INIT,
                  .dev          = dev });

This is compiled (as it seems from the assembly, and as I read from a 
discussion on LKML on how badly GCC optimizes that) compiled as "set this up 
on the stack, memcpy it on the stack, and memcpy it on the final area".

struct slip_data (and the same for slirp_data) contains slip_proto, which is 
6K wide (has two large buffers). Having it twice on the stack gives 12k, 
which explains this output:

$ objdump -d
/home/paolo/Admin/kernel/6/VCS/um-linux-2.6.15-build/vmlinux| ./scripts/checkstack.pl 
i386|head -20

0xa021e0a6 _IO_vfwprintf:                               37512
0xa0020d62 slirp_init:                                  12880
0xa0020e8a slirp_init:                                  12880
0xa0020258 slip_init:                                   12112
0xa0020351 slip_init:                                   12112
...
0xa000515c make_umid_setup:                             4144
0xa002bc16 make_tempfile:                               4128
0xa002bd29 make_tempfile:                               4128

(I remember these to store a PATH_MAX char array on the stack). But 
make_umid_setup just disappeared (the rewritten umid abstraction doesn't use 
significant stack space).
-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade


	

	
		
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

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

end of thread, other threads:[~2006-01-17 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-17  0:26 [uml-devel] slip_init and slirp_init using 12K of stack Blaisorblade
2006-01-17  3:41 ` Jeff Dike
2006-01-17 14:11   ` Blaisorblade

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.