Re: RE: vmspace leak (+ tentative fix)

2001-05-22 Thread Matt Dillon
:> :> The whole point is to release resources as early as possible. Why would :> you ever want to intentionally introduce a race that will 'sometimes' be :> lost and thus cause a late resource release when you can just as easily :> completely guarentee that the resource will be r

Re: RE: vmspace leak (+ tentative fix)

2001-05-22 Thread John Baldwin
On 22-May-01 Matt Dillon wrote: >:>: >:>:John Baldwin <[EMAIL PROTECTED]> -- http://www.FreeBSD.org/~jhb/ >:> >:> Huh? It doesn't look like the same algorithm to me. >: >:In exit1() we attempt to free resources early if we can. If we lose the >:race, >:we still clean it up in vmspace_free(

Re: RE: vmspace leak (+ tentative fix)

2001-05-22 Thread Matt Dillon
:>: :>:John Baldwin <[EMAIL PROTECTED]> -- http://www.FreeBSD.org/~jhb/ :> :> Huh? It doesn't look like the same algorithm to me. : :In exit1() we attempt to free resources early if we can. If we lose the race, :we still clean it up in vmspace_free() called from cpu_wait(). If you check :t

Re: RE: vmspace leak (+ tentative fix)

2001-05-22 Thread John Baldwin
On 22-May-01 Matt Dillon wrote: > >: >: >:On 22-May-01 Matt Dillon wrote: >:>:Ok, then why not let the current shmexit() stay in exit1() as a hack to >:>:help >:>:free memory, but add in a check in vmspace_free() as well to catch any race >:>:conditions that may fall through the cracks? As long

Re: RE: vmspace leak (+ tentative fix)

2001-05-22 Thread Matt Dillon
: : :On 22-May-01 Matt Dillon wrote: :>:Ok, then why not let the current shmexit() stay in exit1() as a hack to help :>:free memory, but add in a check in vmspace_free() as well to catch any race :>:conditions that may fall through the cracks? As long as we clear the shm :>:pointer in struct vms

Re: RE: vmspace leak (+ tentative fix)

2001-05-22 Thread John Baldwin
On 22-May-01 Matt Dillon wrote: >:Ok, then why not let the current shmexit() stay in exit1() as a hack to help >:free memory, but add in a check in vmspace_free() as well to catch any race >:conditions that may fall through the cracks? As long as we clear the shm >:pointer in struct vmspace when

Re: vmspace leak (+ tentative fix)

2001-05-21 Thread Brian F. Feldman
Matt Dillon <[EMAIL PROTECTED]> wrote: > This could explain a few bug reports I've had over the years in regards > to systems leaking swap space. Good find! > > Hmmm. May I suggest an alternative? > > * Keep the part that changes vm->vm_refcnt == 1 to > --vm->vm_refcn

Re: vmspace leak (+ tentative fix)

2001-05-21 Thread Brian F. Feldman
Matt Dillon <[EMAIL PROTECTED]> wrote: > :On 21-May-01 Brian F. Feldman wrote: > :> There's a certain issue that when several processes sharing a vmspace are > :> exiting at the same time, there is a race condition such that the shared > :> memory is going to be lost because the check for vm->vm

Re: RE: vmspace leak (+ tentative fix)

2001-05-21 Thread Matt Dillon
:Ok, then why not let the current shmexit() stay in exit1() as a hack to help :free memory, but add in a check in vmspace_free() as well to catch any race :conditions that may fall through the cracks? As long as we clear the shm :pointer in struct vmspace when we free it then we won't be double f

Re: RE: vmspace leak (+ tentative fix)

2001-05-21 Thread Matt Dillon
: :On Mon, May 21, 2001 at 12:35:17PM -0700, Matt Dillon wrote: : :> It's important to release resources as early as possible, so zombied :> processes don't run the machine out of memory if a parent forgets to :> reap its children. : :I've found one other reason for releasing resource

Re: RE: vmspace leak (+ tentative fix)

2001-05-21 Thread David Malone
On Mon, May 21, 2001 at 12:35:17PM -0700, Matt Dillon wrote: > It's important to release resources as early as possible, so zombied > processes don't run the machine out of memory if a parent forgets to > reap its children. I've found one other reason for releasing resources early. F

Re: RE: vmspace leak (+ tentative fix)

2001-05-21 Thread John Baldwin
On 21-May-01 Matt Dillon wrote: > >:>:John Baldwin <[EMAIL PROTECTED]> -- http://www.FreeBSD.org/~jhb/ >:IOW, the vmspace refcount is being (ab)used for the shm stuff. Why not move >:the shmexit() to vmspace_free()? Hmm, I suppose the actual unmapping of all >:the user pages has this problem

Re: RE: vmspace leak (+ tentative fix)

2001-05-21 Thread Matt Dillon
:>:John Baldwin <[EMAIL PROTECTED]> -- http://www.FreeBSD.org/~jhb/ :> :>That isn't the problem. The problem is that the process can block :>in between the 'if (vm->vm_refcnt == 1)' test in exit1(), and the :>actual vmspace_free() in cpu_exit() (which occurs after the process :>

Re: RE: vmspace leak (+ tentative fix)

2001-05-21 Thread John Baldwin
On 21-May-01 Matt Dillon wrote: >:On 21-May-01 Brian F. Feldman wrote: >:> There's a certain issue that when several processes sharing a vmspace are >:> exiting at the same time, there is a race condition such that the shared >:> memory is going to be lost because the check for vm->vm_refcnt be

Re: RE: vmspace leak (+ tentative fix)

2001-05-21 Thread Matt Dillon
:On 21-May-01 Brian F. Feldman wrote: :> There's a certain issue that when several processes sharing a vmspace are :> exiting at the same time, there is a race condition such that the shared :> memory is going to be lost because the check for vm->vm_refcnt being the :> check for the last decrem

Re: vmspace leak (+ tentative fix)

2001-05-21 Thread Matt Dillon
This could explain a few bug reports I've had over the years in regards to systems leaking swap space. Good find! Hmmm. May I suggest an alternative? * Keep the part that changes vm->vm_refcnt == 1 to --vm->vm_refcnt == 0 when checking whether to free th

RE: vmspace leak (+ tentative fix)

2001-05-21 Thread John Baldwin
On 21-May-01 Brian F. Feldman wrote: > There's a certain issue that when several processes sharing a vmspace are > exiting at the same time, there is a race condition such that the shared > memory is going to be lost because the check for vm->vm_refcnt being the > check for the last decrement