summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2011-06-11 20:15:19 +0000
committerkib <kib@FreeBSD.org>2011-06-11 20:15:19 +0000
commit6b9465356dffc3a21819f75f370e97cf00aa750d (patch)
tree952067390bac12c60b248eb4839b6e2e1c9cf964 /sys/vm
parent27bd440e100100525af7024fe2fcf722059ac220 (diff)
downloadFreeBSD-src-6b9465356dffc3a21819f75f370e97cf00aa750d.zip
FreeBSD-src-6b9465356dffc3a21819f75f370e97cf00aa750d.tar.gz
Assert that page is VPO_BUSY or page owner object is locked in
vm_page_undirty(). The assert is not precise due to VPO_BUSY owner to tracked, so assertion does not catch the case when VPO_BUSY is owned by other thread. Reviewed by: alc
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_page.c17
-rw-r--r--sys/vm/vm_page.h9
2 files changed, 26 insertions, 0 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index e2758ec..21c7080 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -2636,6 +2636,23 @@ vm_page_cowsetup(vm_page_t m)
return (0);
}
+#ifdef INVARIANTS
+void
+vm_page_object_lock_assert(vm_page_t m)
+{
+
+ /*
+ * Certain of the page's fields may only be modified by the
+ * holder of the containing object's lock or the setter of the
+ * page's VPO_BUSY flag. Unfortunately, the setter of the
+ * VPO_BUSY flag is not recorded, and thus cannot be checked
+ * here.
+ */
+ if (m->object != NULL && (m->oflags & VPO_BUSY) == 0)
+ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
+}
+#endif
+
#include "opt_ddb.h"
#ifdef DDB
#include <sys/kernel.h>
diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h
index c34d2f0..898857b 100644
--- a/sys/vm/vm_page.h
+++ b/sys/vm/vm_page.h
@@ -383,6 +383,13 @@ void vm_page_cowfault (vm_page_t);
int vm_page_cowsetup(vm_page_t);
void vm_page_cowclear (vm_page_t);
+#ifdef INVARIANTS
+void vm_page_object_lock_assert(vm_page_t m);
+#define VM_PAGE_OBJECT_LOCK_ASSERT(m) vm_page_object_lock_assert(m)
+#else
+#define VM_PAGE_OBJECT_LOCK_ASSERT(m) (void)0
+#endif
+
/*
* vm_page_sleep_if_busy:
*
@@ -412,6 +419,8 @@ vm_page_sleep_if_busy(vm_page_t m, int also_m_busy, const char *msg)
static __inline void
vm_page_undirty(vm_page_t m)
{
+
+ VM_PAGE_OBJECT_LOCK_ASSERT(m);
m->dirty = 0;
}
OpenPOWER on IntegriCloud