From owner-svn-src-head@FreeBSD.ORG Fri Aug 9 20:51:00 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 979866EF; Fri, 9 Aug 2013 20:51:00 +0000 (UTC) (envelope-from alc@rice.edu) Received: from pp2.rice.edu (proofpoint2.mail.rice.edu [128.42.201.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6205B21D7; Fri, 9 Aug 2013 20:50:59 +0000 (UTC) Received: from pps.filterd (pp2.rice.edu [127.0.0.1]) by pp2.rice.edu (8.14.5/8.14.5) with SMTP id r79BUWaQ016494; Fri, 9 Aug 2013 15:50:58 -0500 Received: from mh2.mail.rice.edu (mh2.mail.rice.edu [128.42.201.21]) by pp2.rice.edu with ESMTP id 1e41r810wq-1; Fri, 09 Aug 2013 15:50:58 -0500 X-Virus-Scanned: by amavis-2.7.0 at mh2.mail.rice.edu, auth channel Received: from [10.104.199.154] (unknown [131.107.165.33]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) (Authenticated sender: alc) by mh2.mail.rice.edu (Postfix) with ESMTPSA id 0192550010D; Fri, 9 Aug 2013 15:50:57 -0500 (CDT) Subject: Re: svn commit: r254150 - head/sys/vm Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: Alan Cox In-Reply-To: <201308091645.26895.jhb@freebsd.org> Date: Fri, 9 Aug 2013 13:50:53 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <79BE43B3-382C-418B-8597-A599182228B3@rice.edu> References: <201308091643.r79GhoWx023884@svn.freebsd.org> <655524DF-4DE9-428C-8A6A-C1A395489EF5@rice.edu> <201308091645.26895.jhb@freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1085) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "David E. O'Brien" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2013 20:51:00 -0000 On Aug 9, 2013, at 1:45 PM, John Baldwin wrote: > On Friday, August 09, 2013 4:40:10 pm Alan Cox wrote: >>=20 >> On Aug 9, 2013, at 1:34 PM, Alan Cox wrote: >>=20 >>>=20 >>> On Aug 9, 2013, at 12:56 PM, John Baldwin wrote: >>>=20 >>>> On Friday, August 09, 2013 12:43:50 pm David E. O'Brien wrote: >>>>> Author: obrien >>>>> Date: Fri Aug 9 16:43:50 2013 >>>>> New Revision: 254150 >>>>> URL: http://svnweb.freebsd.org/changeset/base/254150 >>>>>=20 >>>>> Log: >>>>> Add missing 'VPO_BUSY' from r254141 to fix kernel build break. >>>>>=20 >>>>> Modified: >>>>> head/sys/vm/vm_page.h >>>>=20 >>>> This can't possibly be correct as r254138 just removed this flag. = If it=20 > isn't=20 >>>> obvious how to fix the uses added back in r254141, then r254141 = should be=20 >>>> reverted instead. >>>>=20 >>>> Hmm, looking at the relevant bits of r254141, it doesn't look = obvious: >>>>=20 >>>> + /* Detach the old page from the resident tailq. */ >>>> + TAILQ_REMOVE(&object->memq, mold, listq); >>>> + vm_page_lock(mold); >>>=20 >>> Replace the next four lines with >>>=20 >>> vm_page_xunbusy(mold); >>>=20 >>=20 >> On second thought, no, because it could lead to lock recursion. >=20 > What about this. I think this matches the common idiom I've seen in > other places. >=20 > Index: vm_page.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- vm_page.c (revision 254158) > +++ vm_page.c (working copy) > @@ -1202,12 +1202,9 @@ > /* Detach the old page from the resident tailq. */ > TAILQ_REMOVE(&object->memq, mold, listq); > vm_page_lock(mold); > - if (mold->oflags & VPO_BUSY) { > - mold->oflags &=3D ~VPO_BUSY; > - vm_page_flash(mold); > - } > mold->object =3D NULL; > vm_page_unlock(mold); > + vm_page_xunbusy(mold); >=20 > /* Insert the new page in the resident tailq. */ > if (mpred !=3D NULL) >=20 >=20 > --=20 Index: vm/vm_page.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- vm/vm_page.c (revision 254146) +++ vm/vm_page.c (working copy) @@ -1174,6 +1174,8 @@ vm_page_prev(vm_page_t m) /* * Uses the page mnew as a replacement for an existing page at index * pindex which must be already present in the object. + * + * The existing page must not be on a paging queue. */ vm_page_t vm_page_replace(vm_page_t mnew, vm_object_t object, vm_pindex_t pindex) @@ -1198,16 +1200,14 @@ vm_page_replace(vm_page_t mnew, vm_object_t = object mnew->object =3D object; mnew->pindex =3D pindex; mold =3D vm_radix_replace(&object->rtree, mnew, pindex); + KASSERT(mold->queue =3D=3D PQ_NONE, + ("vm_page_replace: mold is on a paging queue")); =20 /* Detach the old page from the resident tailq. */ TAILQ_REMOVE(&object->memq, mold, listq); - vm_page_lock(mold); - if (mold->oflags & VPO_BUSY) { - mold->oflags &=3D ~VPO_BUSY; - vm_page_flash(mold); - } + mold->object =3D NULL; - vm_page_unlock(mold); + vm_page_xunbusy(mold); =20 /* Insert the new page in the resident tailq. */ if (mpred !=3D NULL)