From 1e96d2a217d596af49e4c3f6af6b2af3e234d7e8 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 18 Oct 2004 08:11:59 +0000 Subject: [PATCH] Correct two errors in PG_BUSY management by vm_page_cowfault(). Both errors are in rarely executed paths. 1. Each time the retry_alloc path is taken, the PG_BUSY must be set again. Otherwise vm_page_remove() panics. 2. There is no need to set PG_BUSY on the newly allocated page before freeing it. The page already has PG_BUSY set by vm_page_alloc(). Setting it again could cause an assertion failure. MFC after: 2 weeks --- sys/vm/vm_page.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 561a5d8b58d..d55530905f6 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1656,9 +1656,9 @@ vm_page_cowfault(vm_page_t m) object = m->object; pindex = m->pindex; - vm_page_busy(m); retry_alloc: + vm_page_busy(m); vm_page_remove(m); mnew = vm_page_alloc(object, pindex, VM_ALLOC_NORMAL); if (mnew == NULL) { @@ -1677,7 +1677,6 @@ vm_page_cowfault(vm_page_t m) * waiting to allocate a page. If so, put things back * the way they were */ - vm_page_busy(mnew); vm_page_free(mnew); vm_page_insert(m, object, pindex); } else { /* clear COW & copy page */