From 9cb574590ef8075477a64baa25976f6e68378b52 Mon Sep 17 00:00:00 2001 From: Brian Feldman Date: Thu, 14 Mar 2002 02:10:14 +0000 Subject: [PATCH] Document faultstate.lookup_still_valid more than none. Requested by: alfred --- sys/vm/vm_fault.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index cf2ab8dd57b7..02a7f460c69e 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -111,7 +111,11 @@ struct faultstate { vm_pindex_t first_pindex; vm_map_t map; vm_map_entry_t entry; - int lookup_still_valid; + enum { + LSV_FALSE, /* the lookup's lock has been dropped */ + LSV_TRUE, /* the lookup's lock is still valid */ + LSV_UPGRADED /* the lookup's lock is now exclusive */ + } lookup_still_valid; struct vnode *vp; }; @@ -126,11 +130,11 @@ release_page(struct faultstate *fs) static __inline void unlock_map(struct faultstate *fs) { - if (fs->lookup_still_valid) { - if (fs->lookup_still_valid == 2) + if (fs->lookup_still_valid != LSV_FALSE) { + if (fs->lookup_still_valid == LSV_UPGRADED) vm_map_lock_downgrade(fs->map); vm_map_lookup_done(fs->map, fs->entry); - fs->lookup_still_valid = FALSE; + fs->lookup_still_valid = LSV_FALSE; } } @@ -284,7 +288,7 @@ RetryFault:; fs.first_pindex, fs.first_pindex + 1); } - fs.lookup_still_valid = 1; + fs.lookup_still_valid = LSV_TRUE; if (wired) fault_type = prot; @@ -658,11 +662,11 @@ RetryFault:; /* * grab the lock if we need to */ - (fs.lookup_still_valid || + (fs.lookup_still_valid != LSV_FALSE || vm_map_try_lock(fs.map) == 0) ) { - if (fs.lookup_still_valid == 0) - fs.lookup_still_valid = 2; + if (fs.lookup_still_valid == LSV_FALSE) + fs.lookup_still_valid = LSV_UPGRADED; /* * get rid of the unnecessary page */ @@ -717,7 +721,7 @@ RetryFault:; * We must verify that the maps have not changed since our last * lookup. */ - if (!fs.lookup_still_valid && + if (fs.lookup_still_valid == LSV_FALSE && (fs.map->timestamp != map_generation)) { vm_object_t retry_object; vm_pindex_t retry_pindex; @@ -766,7 +770,7 @@ RetryFault:; unlock_and_deallocate(&fs); return (result); } - fs.lookup_still_valid = 1; + fs.lookup_still_valid = LSV_TRUE; if ((retry_object != fs.first_object) || (retry_pindex != fs.first_pindex)) {