svn commit: r230836 - stable/9/sys/vm

Konstantin Belousov kib at FreeBSD.org
Tue Jan 31 18:42:22 UTC 2012


Author: kib
Date: Tue Jan 31 18:42:22 2012
New Revision: 230836
URL: http://svn.freebsd.org/changeset/base/230836

Log:
  MFC r228133:
  Hide the internals of vm_page_lock(9) from the loadable modules.

Modified:
  stable/9/sys/vm/vm_page.c
  stable/9/sys/vm/vm_page.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/vm/vm_page.c
==============================================================================
--- stable/9/sys/vm/vm_page.c	Tue Jan 31 18:37:26 2012	(r230835)
+++ stable/9/sys/vm/vm_page.c	Tue Jan 31 18:42:22 2012	(r230836)
@@ -2642,6 +2642,36 @@ vm_page_test_dirty(vm_page_t m)
 		vm_page_dirty(m);
 }
 
+void
+vm_page_lock_KBI(vm_page_t m, const char *file, int line)
+{
+
+	mtx_lock_flags_(vm_page_lockptr(m), 0, file, line);
+}
+
+void
+vm_page_unlock_KBI(vm_page_t m, const char *file, int line)
+{
+
+	mtx_unlock_flags_(vm_page_lockptr(m), 0, file, line);
+}
+
+int
+vm_page_trylock_KBI(vm_page_t m, const char *file, int line)
+{
+
+	return (mtx_trylock_flags_(vm_page_lockptr(m), 0, file, line));
+}
+
+#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
+void
+vm_page_lock_assert_KBI(vm_page_t m, int a, const char *file, int line)
+{
+
+	mtx_assert_(vm_page_lockptr(m), a, file, line);
+}
+#endif
+
 int so_zerocp_fullpage = 0;
 
 /*

Modified: stable/9/sys/vm/vm_page.h
==============================================================================
--- stable/9/sys/vm/vm_page.h	Tue Jan 31 18:37:26 2012	(r230835)
+++ stable/9/sys/vm/vm_page.h	Tue Jan 31 18:42:22 2012	(r230836)
@@ -218,11 +218,23 @@ extern struct vpglocks pa_lock[];
 
 #define	PA_LOCK_ASSERT(pa, a)	mtx_assert(PA_LOCKPTR(pa), (a))
 
+#ifdef KLD_MODULE
+#define	vm_page_lock(m)		vm_page_lock_KBI((m), LOCK_FILE, LOCK_LINE)
+#define	vm_page_unlock(m)	vm_page_unlock_KBI((m), LOCK_FILE, LOCK_LINE)
+#define	vm_page_trylock(m)	vm_page_trylock_KBI((m), LOCK_FILE, LOCK_LINE)
+#if defined(INVARIANTS)
+#define	vm_page_lock_assert(m, a)		\
+    vm_page_lock_assert_KBI((m), (a), __FILE__, __LINE__)
+#else
+#define	vm_page_lock_assert(m, a)
+#endif
+#else	/* !KLD_MODULE */
 #define	vm_page_lockptr(m)	(PA_LOCKPTR(VM_PAGE_TO_PHYS((m))))
 #define	vm_page_lock(m)		mtx_lock(vm_page_lockptr((m)))
 #define	vm_page_unlock(m)	mtx_unlock(vm_page_lockptr((m)))
 #define	vm_page_trylock(m)	mtx_trylock(vm_page_lockptr((m)))
 #define	vm_page_lock_assert(m, a)	mtx_assert(vm_page_lockptr((m)), (a))
+#endif
 
 #define	vm_page_queue_free_mtx	vm_page_queue_free_lock.data
 /*
@@ -403,6 +415,13 @@ void vm_page_cowfault (vm_page_t);
 int vm_page_cowsetup(vm_page_t);
 void vm_page_cowclear (vm_page_t);
 
+void vm_page_lock_KBI(vm_page_t m, const char *file, int line);
+void vm_page_unlock_KBI(vm_page_t m, const char *file, int line);
+int vm_page_trylock_KBI(vm_page_t m, const char *file, int line);
+#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
+void vm_page_lock_assert_KBI(vm_page_t m, int a, const char *file, int line);
+#endif
+
 #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)


More information about the svn-src-stable-9 mailing list