From owner-svn-src-head@freebsd.org Thu Sep 12 16:27:00 2019 Return-Path: Delivered-To: svn-src-head@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 C74C2D362E; Thu, 12 Sep 2019 16:27:00 +0000 (UTC) (envelope-from hselasky@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 46TkgS4wfzz4SY1; Thu, 12 Sep 2019 16:27:00 +0000 (UTC) (envelope-from hselasky@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 8C4D9216B0; Thu, 12 Sep 2019 16:27:00 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8CGR08F029356; Thu, 12 Sep 2019 16:27:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8CGQxCe029348; Thu, 12 Sep 2019 16:26:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201909121626.x8CGQxCe029348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 12 Sep 2019 16:26:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352253 - in head/sys: kern vm X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: kern vm X-SVN-Commit-Revision: 352253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 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: Thu, 12 Sep 2019 16:27:00 -0000 Author: hselasky Date: Thu Sep 12 16:26:59 2019 New Revision: 352253 URL: https://svnweb.freebsd.org/changeset/base/352253 Log: Use REFCOUNT_COUNT() to obtain refcount where appropriate. Refcount waiting will set some flag bits in the refcount value. Make sure these bits get cleared by using the REFCOUNT_COUNT() macro to obtain the actual refcount. Differential Revision: https://reviews.freebsd.org/D21620 Reviewed by: kib@, markj@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/kern/vfs_bio.c head/sys/vm/vm_fault.c head/sys/vm/vm_object.c head/sys/vm/vm_swapout.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Sep 12 16:23:22 2019 (r352252) +++ head/sys/kern/vfs_bio.c Thu Sep 12 16:26:59 2019 (r352253) @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2842,9 +2843,9 @@ vfs_vmio_iodone(struct buf *bp) bool bogus; obj = bp->b_bufobj->bo_object; - KASSERT(obj->paging_in_progress >= bp->b_npages, + KASSERT(REFCOUNT_COUNT(obj->paging_in_progress) >= bp->b_npages, ("vfs_vmio_iodone: paging in progress(%d) < b_npages(%d)", - obj->paging_in_progress, bp->b_npages)); + REFCOUNT_COUNT(obj->paging_in_progress), bp->b_npages)); vp = bp->b_vp; KASSERT(vp->v_holdcnt > 0, Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Thu Sep 12 16:23:22 2019 (r352252) +++ head/sys/vm/vm_fault.c Thu Sep 12 16:26:59 2019 (r352253) @@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -339,7 +340,7 @@ vm_fault_restore_map_lock(struct faultstate *fs) { VM_OBJECT_ASSERT_WLOCKED(fs->first_object); - MPASS(fs->first_object->paging_in_progress > 0); + MPASS(REFCOUNT_COUNT(fs->first_object->paging_in_progress) > 0); if (!vm_map_trylock_read(fs->map)) { VM_OBJECT_WUNLOCK(fs->first_object); @@ -394,7 +395,7 @@ vm_fault_populate(struct faultstate *fs, vm_prot_t pro MPASS(fs->object == fs->first_object); VM_OBJECT_ASSERT_WLOCKED(fs->first_object); - MPASS(fs->first_object->paging_in_progress > 0); + MPASS(REFCOUNT_COUNT(fs->first_object->paging_in_progress) > 0); MPASS(fs->first_object->backing_object == NULL); MPASS(fs->lookup_still_valid); Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Thu Sep 12 16:23:22 2019 (r352252) +++ head/sys/vm/vm_object.c Thu Sep 12 16:26:59 2019 (r352253) @@ -195,9 +195,9 @@ vm_object_zdtor(void *mem, int size, void *arg) ("object %p has reservations", object)); #endif - KASSERT(object->paging_in_progress == 0, + KASSERT(REFCOUNT_COUNT(object->paging_in_progress) == 0, ("object %p paging_in_progress = %d", - object, object->paging_in_progress)); + object, REFCOUNT_COUNT(object->paging_in_progress))); KASSERT(object->resident_page_count == 0, ("object %p resident_page_count = %d", object, object->resident_page_count)); @@ -395,7 +395,7 @@ vm_object_pip_wait(vm_object_t object, char *waitid) VM_OBJECT_ASSERT_WLOCKED(object); - while (object->paging_in_progress) { + while (REFCOUNT_COUNT(object->paging_in_progress) > 0) { VM_OBJECT_WUNLOCK(object); refcount_wait(&object->paging_in_progress, waitid, PVM); VM_OBJECT_WLOCK(object); @@ -408,7 +408,7 @@ vm_object_pip_wait_unlocked(vm_object_t object, char * VM_OBJECT_ASSERT_UNLOCKED(object); - while (object->paging_in_progress) + while (REFCOUNT_COUNT(object->paging_in_progress) > 0) refcount_wait(&object->paging_in_progress, waitid, PVM); } @@ -577,7 +577,7 @@ vm_object_deallocate(vm_object_t object) robject->ref_count++; retry: - if (robject->paging_in_progress) { + if (REFCOUNT_COUNT(robject->paging_in_progress) > 0) { VM_OBJECT_WUNLOCK(object); vm_object_pip_wait(robject, "objde1"); @@ -586,7 +586,7 @@ retry: VM_OBJECT_WLOCK(object); goto retry; } - } else if (object->paging_in_progress) { + } else if (REFCOUNT_COUNT(object->paging_in_progress) > 0) { VM_OBJECT_WUNLOCK(robject); VM_OBJECT_WUNLOCK(object); refcount_wait( @@ -729,7 +729,7 @@ vm_object_terminate(vm_object_t object) */ vm_object_pip_wait(object, "objtrm"); - KASSERT(!object->paging_in_progress, + KASSERT(!REFCOUNT_COUNT(object->paging_in_progress), ("vm_object_terminate: pageout in progress")); KASSERT(object->ref_count == 0, @@ -1660,8 +1660,8 @@ vm_object_collapse(vm_object_t object) break; } - if (object->paging_in_progress != 0 || - backing_object->paging_in_progress != 0) { + if (REFCOUNT_COUNT(object->paging_in_progress) > 0 || + REFCOUNT_COUNT(backing_object->paging_in_progress) > 0) { vm_object_qcollapse(object); VM_OBJECT_WUNLOCK(backing_object); break; Modified: head/sys/vm/vm_swapout.c ============================================================================== --- head/sys/vm/vm_swapout.c Thu Sep 12 16:23:22 2019 (r352252) +++ head/sys/vm/vm_swapout.c Thu Sep 12 16:26:59 2019 (r352253) @@ -90,6 +90,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -193,7 +194,7 @@ vm_swapout_object_deactivate_pages(pmap_t pmap, vm_obj goto unlock_return; VM_OBJECT_ASSERT_LOCKED(object); if ((object->flags & OBJ_UNMANAGED) != 0 || - object->paging_in_progress != 0) + REFCOUNT_COUNT(object->paging_in_progress) > 0) goto unlock_return; remove_mode = 0;