I ported the code to allow gcc to report functions that use too much
of our 3.4KB kernel stacks.

I tried it ou ton a compile of GENERIC.
it produced some 360 functions that allocate over 100 bytes on the stack.

The list is available at:
http://people.freebsd.org/~julian/stack-hogs

It's quite interesting reading.
 I set the limit size to 100 bytes per frame
as that seems a reasonable size to do must things. (remember the 
catch-phrase in teh kernel is "no big structures on the stack")

Consider that many functions call each other, and some can even be
recursive, I find it easy to believe that some of teh off crashes I've
seen over the years may have come from teh 3.5KB being exhusted and the
stack wandering into the u-area where results would be 'dodgy'
at best.

Please take a look and see if any of your pet projects is listed here..

for a quick example here are teh files where over 1K is being allocated on
the stack!

dev/ata/atapi-cd.c:1804: 2068 byte frame 
dev/ata/ata-raid.c:524:  2056 byte frame 
dev/ata/atapi-cd.c:1055: 1756 byte frame 
net/if_sl.c:778:         1540 byte frame 
dev/usb/ugen.c:694:      1168 byte frame 
dev/an/if_an.c:1572:     1112 byte frame 
dev/wi/if_wi.c:1647:     1096 byte frame 
dev/usb/usb_subr.c:897:  1088 byte frame 
kern/imgact_elf.c:668:   1072 byte frame 
dev/usb/ums.c:358:       1056 byte frame 
dev/usb/ukbd.c:182:      1048 byte frame 
dev/awi/awi_wicfg.c:328: 1044 byte frame 
netinet6/nd6.c:2225:     1040 byte frame 
dev/usb/uhid.c:252:      1040 byte frame 
dev/awi/awi_wicfg.c:626: 1040 byte frame 
dev/usb/uscanner.c:322:  1036 byte frame 
dev/usb/urio.c:439:      1036 byte frame 
dev/usb/ulpt.c:333:      1036 byte frame 
dev/usb/if_cue.c:554:    1036 byte frame 
dev/usb/if_aue.c:752:    1036 byte frame 
dev/usb/urio.c:508:      1032 byte frame 
dev/usb/urio.c:290:      1032 byte frame 
dev/usb/ugen.c:767:      1032 byte frame 
dev/wi/if_wi.c:2345:     1028 byte frame 
dev/wi/if_wi.c:2258:     1028 byte frame 
dev/usb/umass.c:968:     1028 byte frame 
dev/usb/ugen.c:228:      1028 byte frame 
dev/usb/if_kue.c:511:    1028 byte frame 
netinet6/nd6.c:2151:     1024 byte frame 

Remember these are only in GENERIC.

Julian


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to