svn commit: r222992 - head/sys/vm
Konstantin Belousov
kib at FreeBSD.org
Sat Jun 11 20:15:20 UTC 2011
Author: kib
Date: Sat Jun 11 20:15:19 2011
New Revision: 222992
URL: http://svn.freebsd.org/changeset/base/222992
Log:
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
Modified:
head/sys/vm/vm_page.c
head/sys/vm/vm_page.h
Modified: head/sys/vm/vm_page.c
==============================================================================
--- head/sys/vm/vm_page.c Sat Jun 11 20:13:28 2011 (r222991)
+++ head/sys/vm/vm_page.c Sat Jun 11 20:15:19 2011 (r222992)
@@ -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>
Modified: head/sys/vm/vm_page.h
==============================================================================
--- head/sys/vm/vm_page.h Sat Jun 11 20:13:28 2011 (r222991)
+++ head/sys/vm/vm_page.h Sat Jun 11 20:15:19 2011 (r222992)
@@ -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 a
static __inline void
vm_page_undirty(vm_page_t m)
{
+
+ VM_PAGE_OBJECT_LOCK_ASSERT(m);
m->dirty = 0;
}
More information about the svn-src-all
mailing list