Re: A fix of recent bugs in swapping in/out a process
I committed your patch. Thankyou for doing this work. I a very pleased that other people are looking at this system and code. I could get almost no-one to review before I committed so I am pleased that people do look at it and try understand it after I committed! To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: A fix of recent bugs in swapping in/out a process
great.. looks like it's a commit... On Mon, 29 Jul 2002, Mark Santcroos wrote: > Hi, > > Just want to let you know that this patch fixes the 'fault on nofault > entry' panics I had. > > It was very easily reproducable with: > --- > char *buf; int n=0; > buf=(char *)malloc(1); > for(;;) > buf=(char *)realloc(buf,n++*1024*1024); > --- > > Ran some tests now and as said it didn't happen again. > > Thanks alot. > > Mark > > > On Sun, Jul 28, 2002 at 09:51:57PM +0900, Seigo Tanimura wrote: > > 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: > > > > http://people.FreeBSD.org/~tanimura/patches/procswap.diff.gz > > > > 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 > >process. > > > > 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. > > > > -- > > Seigo Tanimura <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> > > > > To Unsubscribe: send mail to [EMAIL PROTECTED] > > with "unsubscribe freebsd-current" in the body of the message > > -- > Mark SantcroosRIPE Network Coordination Centre > http://www.ripe.net/home/mark/New Projects Group/TTM > > To Unsubscribe: send mail to [EMAIL PROTECTED] > with "unsubscribe freebsd-current" in the body of the message > To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: A fix of recent bugs in swapping in/out a process
A couple of updates: - Optimize wakeup() and its friends; if a thread waken up is being swapped in, we do not have to ask for the scheduler thread to do that. - Assert that a process is not swapped out in runq functions and swapout(). The update patchs is at: http://people.FreeBSD.org/~tanimura/patches/procswap_2.diff.gz On Sun, 28 Jul 2002 21:51:57 +0900, Seigo Tanimura <[EMAIL PROTECTED]> said: Seigo> If you are having a trouble of a broken thread state (eg a thread with Seigo> TDS_RUNQ on no run queue) or a mysterious page fault on a kernel Seigo> memory (probably in mi_switch()), you may want to try my patch at: Seigo> http://people.FreeBSD.org/~tanimura/patches/procswap.diff.gz Seigo> In a nutshell, this patch fixes three bugs: Seigo> 1. a thread with TDS_RUNQ on no run queue. Seigo> This is due to wakeup() and wakeup_one() setting the state to a thread Seigo> to TDS_RUNQ even if the thread has been swapped out. As a thread Seigo> being or having been swapped out cannot be scheduled immediately, Seigo> introduce a new thread state TDS_SWAPPED to note that. Seigo> 2. a possible race condition for multiple threads to swap in a single Seigo>process. Seigo> Since faultin() may block (and likely to do so) without leaving any Seigo> flags for a process being swapped in, more than one threads can call Seigo> faultin() for the same process. Avoid this by adding a new process Seigo> state flag PS_SWAPPINGIN to a process being swapped in. Seigo> 3. a running thread being swapped out. Seigo> Swapout_procs() and swapout() do not check the states of the threads Seigo> in a process about to be swapped out. This causes the pcb and the Seigo> kernel stack of a running thread being unmapped, resulting in a Seigo> page fault in cpu_switch(). Do not swap out a process unless all of Seigo> its threads are either in a run queue or sleeping. Seigo> Eventually, it may become our option to swap out only threads that are Seigo> safe to do so. -- Seigo Tanimura <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: A fix of recent bugs in swapping in/out a process
Hi, Just want to let you know that this patch fixes the 'fault on nofault entry' panics I had. It was very easily reproducable with: --- char *buf; int n=0; buf=(char *)malloc(1); for(;;) buf=(char *)realloc(buf,n++*1024*1024); --- Ran some tests now and as said it didn't happen again. Thanks alot. Mark On Sun, Jul 28, 2002 at 09:51:57PM +0900, Seigo Tanimura wrote: > 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: > > http://people.FreeBSD.org/~tanimura/patches/procswap.diff.gz > > 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 >process. > > 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. > > -- > Seigo Tanimura <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> > > To Unsubscribe: send mail to [EMAIL PROTECTED] > with "unsubscribe freebsd-current" in the body of the message -- Mark Santcroos RIPE Network Coordination Centre http://www.ripe.net/home/mark/ New Projects Group/TTM To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: A fix of recent bugs in swapping in/out a process
On Sun, 28 Jul 2002, Seigo Tanimura wrote: > 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: > http://people.FreeBSD.org/~tanimura/patches/procswap.diff.gz I applied this patch a few hours ago and have not had a panic since, even though the box has been used a lot and has been swapping a lot. It looks like this has fixed my problem. Thanks! gavin To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: A fix of recent bugs in swapping in/out a process
>Date: Sun, 28 Jul 2002 21:51:57 +0900 >From: Seigo Tanimura <[EMAIL PROTECTED]> >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: >http://people.FreeBSD.org/~tanimura/patches/procswap.diff.gz I was having this kind of trouble with my (UP) laptop, but not my (SMP) build machine. However, the laptop may also be having some hardware issues, so I didn't press the issue But after getting another panic after trying to reboot after installing today's -CURRENT on the laptop, I applied that patch, and so far, things seem better. What I did: * Fetched the patch & unzipped it. * cd /usr/src/sys && patch -p6 <~/PATCHES/procswap.diff (I actually ran "patch -C" first, to verify that things looked good.) * cd /usr/src && make kernel KERNCONF=LAPTOP_30W * reboot (after a few syncs, in case that might help). * cd /usr/src && date && make installworld && date && \ mergemaster -u 0022 -i && date && df -k (I.e., re-do the "make installworld & mergemaster steps from the install where I had a panic on reboot, both to have some assurance that files I'd rather have didn't get truncated, and to serve as a first- order test of the patched code.) * reboot * Run a few tests. So far, so good. Thanks! Cheers, david (links to my resume at http://www.catwhisker.org/~david) -- David H. Wolfskill [EMAIL PROTECTED] To paraphrase David Hilbert, there can be no conflicts between Microsoft and the discipline of systems administration, since they have nothing in common. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
A fix of recent bugs in swapping in/out a process
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: http://people.FreeBSD.org/~tanimura/patches/procswap.diff.gz 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 process. 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. -- Seigo Tanimura <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message