Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 May 2001 10:58:54 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        "Brian F. Feldman" <green@FreeBSD.org>
Cc:        hackers@FreeBSD.org
Subject:   RE: vmspace leak (+ tentative fix)
Message-ID:  <XFMail.010521105854.jhb@FreeBSD.org>
In-Reply-To: <200105210205.f4L25x102099@green.bikeshed.org>

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

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 happening before the last decrement is
> actually performed, allowing for the possibility of Giant being dropped 
> (duh, during flushing of dirty pages), and all the trouble that entails...

Erm, all that is needed here is to hold the vm_mtx lock around the decrement.
Due to the nature of reference counts, there is no race condition so long as
everyone properly decrements the reference count by means of lock.  Alfred's VM
patch already does this.  Also, Giant originally provided the lock around the
decrement.

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.010521105854.jhb>