Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Nov 2016 05:57:45 +0000 (UTC)
From:      Alan Cox <alc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r308359 - stable/11/sys/vm
Message-ID:  <201611060557.uA65vjvK090428@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alc
Date: Sun Nov  6 05:57:44 2016
New Revision: 308359
URL: https://svnweb.freebsd.org/changeset/base/308359

Log:
  MFC r308096, r308098, r308112
    With one exception, "hardfault" is used like a "bool".  Change that
    exception and make it a "bool".
  
    The "lookup_still_valid" field is used as a "bool".  Make it one.
  
    Convert vm_fault_hold()'s Boolean variables that are only used
    internally to "bool".  Add a comment describing why the one
    remaining "boolean_t" was not converted.
  
    Merge and sort vm_fault_hold()'s "int" variable definitions.

Modified:
  stable/11/sys/vm/vm_fault.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/vm_fault.c
==============================================================================
--- stable/11/sys/vm/vm_fault.c	Sun Nov  6 02:33:04 2016	(r308358)
+++ stable/11/sys/vm/vm_fault.c	Sun Nov  6 05:57:44 2016	(r308359)
@@ -122,7 +122,7 @@ struct faultstate {
 	vm_pindex_t first_pindex;
 	vm_map_t map;
 	vm_map_entry_t entry;
-	int lookup_still_valid;
+	bool lookup_still_valid;
 	struct vnode *vp;
 };
 
@@ -148,7 +148,7 @@ unlock_map(struct faultstate *fs)
 
 	if (fs->lookup_still_valid) {
 		vm_map_lookup_done(fs->map, fs->entry);
-		fs->lookup_still_valid = FALSE;
+		fs->lookup_still_valid = false;
 	}
 }
 
@@ -291,24 +291,23 @@ vm_fault_hold(vm_map_t map, vm_offset_t 
     int fault_flags, vm_page_t *m_hold)
 {
 	vm_prot_t prot;
-	int alloc_req, era, faultcount, nera, result;
-	boolean_t dead, growstack, is_first_object_locked, wired;
-	int map_generation;
 	vm_object_t next_object;
-	int hardfault;
 	struct faultstate fs;
 	struct vnode *vp;
 	vm_offset_t e_end, e_start;
 	vm_page_t m;
-	int ahead, behind, cluster_offset, error, locked, rv;
+	int ahead, alloc_req, behind, cluster_offset, error, era, faultcount;
+	int locked, map_generation, nera, result, rv;
 	u_char behavior;
+	boolean_t wired;	/* Passed by reference. */
+	bool dead, growstack, hardfault, is_first_object_locked;
 
-	hardfault = 0;
-	growstack = TRUE;
 	PCPU_INC(cnt.v_vm_faults);
 	fs.vp = NULL;
 	faultcount = 0;
 	nera = -1;
+	growstack = true;
+	hardfault = false;
 
 RetryFault:;
 
@@ -325,7 +324,7 @@ RetryFault:;
 			result = vm_map_growstack(curproc, vaddr);
 			if (result != KERN_SUCCESS)
 				return (KERN_FAILURE);
-			growstack = FALSE;
+			growstack = false;
 			goto RetryFault;
 		}
 		unlock_vp(&fs);
@@ -427,7 +426,7 @@ fast_failed:
 	vm_object_reference_locked(fs.first_object);
 	vm_object_pip_add(fs.first_object, 1);
 
-	fs.lookup_still_valid = TRUE;
+	fs.lookup_still_valid = true;
 
 	fs.first_m = NULL;
 
@@ -708,7 +707,7 @@ vnode_locked:
 			    &behind, &ahead);
 			if (rv == VM_PAGER_OK) {
 				faultcount = behind + 1 + ahead;
-				hardfault++;
+				hardfault = true;
 				break; /* break to PAGE HAS BEEN FOUND */
 			}
 			if (rv == VM_PAGER_ERROR)
@@ -836,7 +835,7 @@ vnode_locked:
 			 * dirty in the first object so that it will go out 
 			 * to swap when needed.
 			 */
-			is_first_object_locked = FALSE;
+			is_first_object_locked = false;
 			if (
 				/*
 				 * Only one shadow object
@@ -941,7 +940,7 @@ vnode_locked:
 			unlock_and_deallocate(&fs);
 			goto RetryFault;
 		}
-		fs.lookup_still_valid = TRUE;
+		fs.lookup_still_valid = true;
 		if (fs.map->timestamp != map_generation) {
 			result = vm_map_lookup_locked(&fs.map, vaddr, fault_type,
 			    &fs.entry, &retry_object, &retry_pindex, &retry_prot, &wired);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611060557.uA65vjvK090428>