From owner-svn-src-head@freebsd.org Sun Sep 24 23:35:02 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B337E0405B; Sun, 24 Sep 2017 23:35:02 +0000 (UTC) (envelope-from alc@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 mx1.freebsd.org (Postfix) with ESMTPS id 1DC6C66190; Sun, 24 Sep 2017 23:35:02 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8ONZ1GK004982; Sun, 24 Sep 2017 23:35:01 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8ONZ19m004981; Sun, 24 Sep 2017 23:35:01 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201709242335.v8ONZ19m004981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 24 Sep 2017 23:35:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323982 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 323982 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.23 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: Sun, 24 Sep 2017 23:35:02 -0000 Author: alc Date: Sun Sep 24 23:35:01 2017 New Revision: 323982 URL: https://svnweb.freebsd.org/changeset/base/323982 Log: Change vm_page_try_to_free() to require a managed page. Essentially, vm_page_try_to_free() is testing conditions, like clean versus dirty, that only vary in managed pages. Suggested by: kib Reviewed by: markj X-MFC after: never Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sun Sep 24 22:29:11 2017 (r323981) +++ head/sys/vm/vm_page.c Sun Sep 24 23:35:01 2017 (r323982) @@ -3078,22 +3078,23 @@ vm_page_unswappable(vm_page_t m) } /* - * vm_page_try_to_free() + * Attempt to free the page. If it cannot be freed, do nothing. Returns true + * if the page is freed and false otherwise. * - * Attempt to free the page. If we cannot free it, we do nothing. - * true is returned on success, false on failure. + * The page must be managed. The page and its containing object must be + * locked. */ bool vm_page_try_to_free(vm_page_t m) { vm_page_assert_locked(m); - if (m->object != NULL) - VM_OBJECT_ASSERT_WLOCKED(m->object); + VM_OBJECT_ASSERT_WLOCKED(m->object); + KASSERT((m->oflags & VPO_UNMANAGED) == 0, ("page %p is unmanaged", m)); if (m->dirty != 0 || m->hold_count != 0 || m->wire_count != 0 || - (m->oflags & VPO_UNMANAGED) != 0 || vm_page_busied(m)) + vm_page_busied(m)) return (false); - if (m->object != NULL && m->object->ref_count != 0) { + if (m->object->ref_count != 0) { pmap_remove_all(m); if (m->dirty != 0) return (false);