From a7039a1d4287a42fb7c72d2a2a68c8fa86baae32 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 24 Jan 1999 01:05:15 +0000 Subject: [PATCH] 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(-) diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index 685c53b66d6d..c74af825a7e8 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) {