Re: FreeBSD 5.3 crash (core with debug symbols available)

From: Robert Watson <rwatson_at_FreeBSD.org>
Date: Thu, 3 Mar 2005 13:41:53 +0000 (GMT)
On Thu, 3 Mar 2005, David Xu wrote:

> >The consensus on IRC is that threads should not use their stacks for
> >anything but storage of their own variables. Anything used for
> >synchronization or state should be placed in malloc()d memory or some
> >other shared structure.
> 
> Stack variable is cheap and fastest, why should I use slow malloc ? 

So you don't page fault, of course :-). 

> >I'll start working on a patch to change these references in the sigwait()
> >family. And queue up a pointy hat to jeff_at_.  Pointers to other badly
> >behaved code gladly accepted :)
> 
> This is not a bug, I always perfer to use stack variable because there
> is no lock order reversal and have to work around it.  If I am correct,
> Linux and DragonFly both disable kernel stack to be swapped out.

There was a time where the swapping out of kernel thread stacks under load
made a significant difference under high memory pressure.  The question is
whether that's still true enough to justify the overhead and complications
it presents today.  For one thing, we pay several extra mutex operations
per page fault to prevent swapping of the kernel stack in memory during
the fault.  And I'm sure this is not the only situation where we have a
latent bug involving paged out kernel stacks and structures getting hooked
to global lists.

Robert N M Watson
Received on Thu Mar 03 2005 - 12:43:56 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:29 UTC