FreeBSD 5.3 crash (core with debug symbols available)

David Xu davidxu at freebsd.org
Thu Mar 3 05:07:37 GMT 2005


Doug White wrote:

>On Wed, 2 Mar 2005, David Xu wrote:
>
>  
>
>>I believe this is caused by swapped out of kernel thread stack.
>>in /sys/vm/vm_glue.c, there is some code swapping out a sleeping process,
>>this means any kernel code can not use thread local variable to communicate
>>with other threads, this is a rather unsafe assumptions, the vm code really
>>should be disabled.
>>    
>>
>
>I don't quite understand what you mean by "vm code really should be
>disabled";  is virtual memory really that bad? :)
>
>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 ?

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

David Xu



More information about the freebsd-current mailing list