From 84015ba9cbf32a56da8e0a35a1f0879597f4a674 Mon Sep 17 00:00:00 2001 From: dillon Date: Sun, 24 Jan 1999 01:05:15 +0000 Subject: Add invariants to vm_page_busy() and vm_page_wakeup() to check for PG_BUSY stupidity. --- sys/vm/vm_page.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'sys') diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 685c53b..c74af82 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -61,7 +61,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: vm_page.h,v 1.50 1999/01/21 08:29:12 dillon Exp $ + * $Id: vm_page.h,v 1.51 1999/01/21 10:06:24 dillon Exp $ */ /* @@ -312,6 +312,7 @@ vm_page_assert_wait(vm_page_t m, int interruptible) static __inline void vm_page_busy(vm_page_t m) { + KASSERT((m->flags & PG_BUSY) == 0, ("vm_page_busy: page already busy!!!")); vm_page_flag_set(m, PG_BUSY); } @@ -341,6 +342,7 @@ vm_page_flash(vm_page_t m) static __inline void vm_page_wakeup(vm_page_t m) { + KASSERT(m->flags & PG_BUSY, ("vm_page_wakeup: page not busy!!!")); vm_page_flag_clear(m, PG_BUSY); vm_page_flash(m); } @@ -426,6 +428,15 @@ vm_page_unhold(vm_page_t mem) KASSERT(mem->hold_count >= 0, ("vm_page_unhold: hold count < 0!!!")); } +/* + * vm_page_protect: + * + * Reduce the protection of a page. This routine never + * raises the protection and therefore can be safely + * called if the page is already at VM_PROT_NONE ( it + * will be a NOP effectively ). + */ + static __inline void vm_page_protect(vm_page_t mem, int prot) { -- cgit v1.1