From owner-svn-src-all@freebsd.org Tue Oct 15 03:38:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63A961525F6; Tue, 15 Oct 2019 03:38:04 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46sh301rg5z4cnQ; Tue, 15 Oct 2019 03:38:04 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 229CD18A07; Tue, 15 Oct 2019 03:38:04 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9F3c3q0023022; Tue, 15 Oct 2019 03:38:03 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9F3c31W023017; Tue, 15 Oct 2019 03:38:03 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201910150338.x9F3c31W023017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 15 Oct 2019 03:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353537 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2019 03:38:04 -0000 Author: jeff Date: Tue Oct 15 03:38:02 2019 New Revision: 353537 URL: https://svnweb.freebsd.org/changeset/base/353537 Log: (2/6) Don't release xbusy in vm_page_remove(), defer to vm_page_free_prep(). This persists busy state across operations like rename and replace. Reviewed by: kib, markj Tested by: pho Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D21549 Modified: head/sys/vm/device_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c Modified: head/sys/vm/device_pager.c ============================================================================== --- head/sys/vm/device_pager.c Tue Oct 15 03:37:21 2019 (r353536) +++ head/sys/vm/device_pager.c Tue Oct 15 03:38:02 2019 (r353537) @@ -236,6 +236,7 @@ cdev_pager_free_page(vm_object_t object, vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("unmanaged %p", m)); pmap_remove_all(m); (void)vm_page_remove(m); + vm_page_xunbusy(m); } else if (object->type == OBJT_DEVICE) dev_pager_free_page(object, m); } Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Oct 15 03:37:21 2019 (r353536) +++ head/sys/vm/vm_fault.c Tue Oct 15 03:38:02 2019 (r353537) @@ -1231,11 +1231,6 @@ readrest: fs.object, OFF_TO_IDX( fs.first_object->backing_object_offset)); #endif - /* - * Removing the page from the backing object - * unbusied it. - */ - vm_page_xbusy(fs.m); fs.first_m = fs.m; fs.m = NULL; VM_CNT_INC(v_cow_optim); Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Tue Oct 15 03:37:21 2019 (r353536) +++ head/sys/vm/vm_object.c Tue Oct 15 03:38:02 2019 (r353537) @@ -1366,7 +1366,6 @@ retry: VM_OBJECT_WLOCK(new_object); goto retry; } - /* Rename released the xbusy lock. */ #if VM_NRESERVLEVEL > 0 /* @@ -1383,8 +1382,8 @@ retry: */ vm_reserv_rename(m, new_object, orig_object, offidxstart); #endif - if (orig_object->type == OBJT_SWAP) - vm_page_xbusy(m); + if (orig_object->type != OBJT_SWAP) + vm_page_xunbusy(m); } if (orig_object->type == OBJT_SWAP) { /* @@ -1538,6 +1537,8 @@ vm_object_collapse_scan(vm_object_t object, int op) ("freeing mapped page %p", p)); if (vm_page_remove(p)) vm_page_free(p); + else + vm_page_xunbusy(p); continue; } @@ -1579,6 +1580,8 @@ vm_object_collapse_scan(vm_object_t object, int op) ("freeing mapped page %p", p)); if (vm_page_remove(p)) vm_page_free(p); + else + vm_page_xunbusy(p); if (pp != NULL) vm_page_xunbusy(pp); continue; @@ -1599,7 +1602,6 @@ vm_object_collapse_scan(vm_object_t object, int op) op); continue; } - /* Rename released the xbusy lock. */ /* Use the old pindex to free the right page. */ if (backing_object->type == OBJT_SWAP) @@ -1613,6 +1615,7 @@ vm_object_collapse_scan(vm_object_t object, int op) vm_reserv_rename(p, object, backing_object, backing_offset_index); #endif + vm_page_xunbusy(p); } return (true); } Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Oct 15 03:37:21 2019 (r353536) +++ head/sys/vm/vm_page.c Tue Oct 15 03:38:02 2019 (r353537) @@ -1227,6 +1227,8 @@ vm_page_putfake(vm_page_t m) KASSERT((m->oflags & VPO_UNMANAGED) != 0, ("managed %p", m)); KASSERT((m->flags & PG_FICTITIOUS) != 0, ("vm_page_putfake: bad page %p", m)); + if (vm_page_xbusied(m)) + vm_page_xunbusy(m); uma_zfree(fakepg_zone, m); } @@ -1519,8 +1521,7 @@ vm_page_object_remove(vm_page_t m) VM_OBJECT_ASSERT_WLOCKED(object); KASSERT((m->ref_count & VPRC_OBJREF) != 0, ("page %p is missing its object ref", m)); - if (vm_page_xbusied(m)) - vm_page_xunbusy(m); + mrem = vm_radix_remove(&object->rtree, m->pindex); KASSERT(mrem == m, ("removed page %p, expected page %p", mrem, m)); @@ -3590,7 +3591,7 @@ vm_page_free_prep(vm_page_t m) VM_CNT_INC(v_tfree); if (vm_page_sbusied(m)) - panic("vm_page_free_prep: freeing busy page %p", m); + panic("vm_page_free_prep: freeing shared busy page %p", m); if (m->object != NULL) { vm_page_object_remove(m); @@ -3606,6 +3607,9 @@ vm_page_free_prep(vm_page_t m) m->object = NULL; m->ref_count -= VPRC_OBJREF; } + + if (vm_page_xbusied(m)) + vm_page_xunbusy(m); /* * If fictitious remove object association and