Date: Mon, 3 Apr 2000 08:20:08 -0700 (PDT) From: Frank Mayhar <frank@exit.com> To: Poul-Henning Kamp <phk@critter.freebsd.dk> Cc: Gary Jennejohn <garyj@muc.de>, Alfred Perlstein <bright@wintelcom.net>, Hellmuth Michaelis <hm@hcs.de>, freebsd-current@FreeBSD.ORGG Subject: Re: MLEN and crashes Message-ID: <200004031526.IAA37084@realtime.exit.com> In-Reply-To: <19865.954756081@critter.freebsd.dk> from Poul-Henning Kamp at "Apr 3, 2000 12:01:21 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
Poul-Henning Kamp wrote: > In message <200004030935.LAA48677@peedub.muc.de>, Gary Jennejohn writes: > > >Yes, but it was perfectly legal to put the structure on the stack > >_before_ MLEN was doubled. > > Just because it worked doesn't mean that it was correct. > > We need to be frugal about the kernel stack, for a lot of reasons, > that's just the way it is, and as far as I know it is the way > it will continue to be. To be a little less harsh about it (Poul, you could _really_ stand to work on your phrasing, this sounded unnecessarily harsh), kernel stack space is (in pretty much any kernel -- the one I work on is Unixware 7) a very scarce resource. You can put variables on the stack, but even that can make it run out for really long path lengths. If you have a structure or an array, the rule of thumb is to _always_ malloc it. This will save your bacon when the structure grows (as in this case) or the path gets a little longer, or something else happens that makes you run out of kernel stack. This is the way it is in kernel land. I won't say "get used to it," that's unnecessarily harsh, but it _is_ the way it is. Read, learn, evolve, as they say in talk.bizarre. And become a better kernel programmer thereby. -- Frank Mayhar frank@exit.com http://www.exit.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004031526.IAA37084>