Date: Tue, 25 Aug 2020 13:45:06 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364768 - head/sys/vm Message-ID: <202008251345.07PDj609067488@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Tue Aug 25 13:45:06 2020 New Revision: 364768 URL: https://svnweb.freebsd.org/changeset/base/364768 Log: Permit vm_page_wire() to be called on pages not belonging to an object. For such pages ref_count is effectively a consumer-managed field, but there is no harm in calling vm_page_wire() on them. vm_page_unwire_noq() handles them as well. Relax the vm_page_wire() assertions to permit this case which is triggered by some out-of-tree code. [1] Also guard a conditional assertion with INVARIANTS. Otherwise the conditions are evaluated even though the result is unused. [2] Reported by: bz, cem [1], kib [2] Reviewed by: dougm, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26173 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Tue Aug 25 13:30:34 2020 (r364767) +++ head/sys/vm/vm_page.c Tue Aug 25 13:45:06 2020 (r364768) @@ -3854,18 +3854,19 @@ vm_page_free_pages_toq(struct spglist *free, bool upda } /* - * Mark this page as wired down, preventing reclamation by the page daemon - * or when the containing object is destroyed. + * Mark this page as wired down. For managed pages, this prevents reclamation + * by the page daemon, or when the containing object, if any, is destroyed. */ void vm_page_wire(vm_page_t m) { u_int old; - KASSERT(m->object != NULL, - ("vm_page_wire: page %p does not belong to an object", m)); - if (!vm_page_busied(m) && !vm_object_busied(m->object)) +#ifdef INVARIANTS + if (m->object != NULL && !vm_page_busied(m) && + !vm_object_busied(m->object)) VM_OBJECT_ASSERT_LOCKED(m->object); +#endif KASSERT((m->flags & PG_FICTITIOUS) == 0 || VPRC_WIRE_COUNT(m->ref_count) >= 1, ("vm_page_wire: fictitious page %p has zero wirings", m));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008251345.07PDj609067488>