Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Mar 2005 13:41:53 +0000 (GMT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        David Xu <davidxu@freebsd.org>
Cc:        peter@FreeBSD.org
Subject:   Re: FreeBSD 5.3 crash (core with debug symbols available)
Message-ID:  <Pine.NEB.3.96L.1050303133720.80219D-100000@fledge.watson.org>
In-Reply-To: <42269B85.3050602@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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@.  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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1050303133720.80219D-100000>