Subject: Re: wd.c patch to reduce kernel stack usage
To: None <tech-kern@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 06/28/2002 00:14:27
On Thu, Jun 27, 2002 at 01:22:03PM -0700, Jason R Thorpe wrote:
> On Thu, Jun 27, 2002 at 10:07:50PM +0200, Jaromir Dolecek wrote:
>
> > switch (retval) {
> > case ERROR:
> > {
> > char buf[256], *errbuf = &buf;
> > /* do error handling */
> > break;
> > }
>
> I don't think it would. The compiler may allocate stack frame space for
> that anyway.
>
> Use of alloca() is one possibility. But that still comes from the stack,
> do you'd want to make the buffer smaller, as well, I guess.
>
> Reducing kernel stack usage is good ... but having to allocate memory
> in an error handler doesn't seem like the best idea...
Well its not a performance critical piece of code, and it is (probably)
unlikely that lack of memory is responsible for a disk error.
(and not to be reported elsewhere).
OTOH it might be 'safe' to use a static buffer and not care
about the garbled messages that might occurr.
Could even lock the static buffer!
Maybe you could guarantee that the lack of in kernal pre-emption
means that the buffer is never reused?
David
--
David Laight: david@l8s.co.uk