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
This commit is contained in:
parent
9d17da3bef
commit
3b1025d200
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=222992
@ -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>
|
||||
|
@ -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 also_m_busy, const char *msg)
|
||||
static __inline void
|
||||
vm_page_undirty(vm_page_t m)
|
||||
{
|
||||
|
||||
VM_PAGE_OBJECT_LOCK_ASSERT(m);
|
||||
m->dirty = 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user