If you are having a trouble of a broken thread state (eg a thread with
TDS_RUNQ on no run queue) or a mysterious page fault on a kernel
memory (probably in mi_switch()), you may want to try my patch at:


In a nutshell, this patch fixes three bugs:

1. a thread with TDS_RUNQ on no run queue.

This is due to wakeup() and wakeup_one() setting the state to a thread
to TDS_RUNQ even if the thread has been swapped out.  As a thread
being or having been swapped out cannot be scheduled immediately,
introduce a new thread state TDS_SWAPPED to note that.

2. a possible race condition for multiple threads to swap in a single

Since faultin() may block (and likely to do so) without leaving any
flags for a process being swapped in, more than one threads can call
faultin() for the same process.  Avoid this by adding a new process
state flag PS_SWAPPINGIN to a process being swapped in.

3. a running thread being swapped out.

Swapout_procs() and swapout() do not check the states of the threads
in a process about to be swapped out.  This causes the pcb and the
kernel stack of a running thread being unmapped, resulting in a
page fault in cpu_switch().  Do not swap out a process unless all of
its threads are either in a run queue or sleeping.

Eventually, it may become our option to swap out only threads that are
safe to do so.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to