Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Sep 1998 22:21:55 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        current@FreeBSD.ORG
Subject:   VM diagnostic code never committed?
Message-ID:  <199809272221.PAA01831@usr05.primenet.com>

next in thread | raw e-mail | index | archive | help
I looked for this code in -current, but was unable to find it; was it never
committed?

This patch basically fills in the one remaining hole in the VM
MAP_LOCK_DIAGNOSTIC case.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.
----------------------------------------------------------------------------
*** vm_fault.c	Mon May  4 03:01:43 1998
--- vm_fault.c.new	Sat Aug 15 22:45:59 1998
***************
*** 590,597 ****
  				 */
  				(fs.lookup_still_valid ||
  						(((fs.entry->eflags & MAP_ENTRY_IS_A_MAP) == 0) &&
! 						 lockmgr(&fs.map->lock,
! 							LK_EXCLUSIVE|LK_NOWAIT, (void *)0, curproc) == 0))) {
  				
  				fs.lookup_still_valid = 1;
  				/*
--- 590,596 ----
  				 */
  				(fs.lookup_still_valid ||
  						(((fs.entry->eflags & MAP_ENTRY_IS_A_MAP) == 0) &&
! 						 vm_map_lock_try(fs.map) == 0))) {
  				
  				fs.lookup_still_valid = 1;
  				/*
*** vm_glue.c	Wed Mar  4 10:27:00 1998
--- vm_glue.c.new	Sat Aug 15 22:47:13 1998
***************
*** 452,460 ****
  			 * do not swapout a process that is waiting for VM
  			 * data structures there is a possible deadlock.
  			 */
! 			if (lockmgr(&vm->vm_map.lock,
! 					LK_EXCLUSIVE | LK_NOWAIT,
! 					(void *)0, curproc)) {
  				vmspace_free(vm);
  				continue;
  			}
--- 452,459 ----
  			 * do not swapout a process that is waiting for VM
  			 * data structures there is a possible deadlock.
  			 */
! 			if (vm_map_lock_try(&vm->vm_map)) {
! 				/* failed to obtain lock*/
  				vmspace_free(vm);
  				continue;
  			}
*** vm_map.h	Thu Jan 22 17:30:38 1998
--- vm_map.h.new	Sat Aug 15 23:22:14 1998
***************
*** 242,247 ****
--- 242,261 ----
  #endif
  
  static __inline__ int
+ _vm_map_lock_try(vm_map_t map, struct proc *p) {
+ 	int	rv;
+ 
+ 	rv = lockmgr(&(map)->lock, LK_EXCLUSIVE | LK_NOWAIT, (void *)0, p);
+ #if defined(MAP_LOCK_DIAGNOSTIC)
+ 	if( !rv)
+ 		printf("locking map LK_EXCLUSIVE: 0x%x\n", map);
+ #endif
+ 	return rv;
+ }
+ 
+ #define vm_map_lock_try(map) _vm_map_lock_try(map, curproc)
+ 
+ static __inline__ int
  _vm_map_lock_upgrade(vm_map_t map, struct proc *p) {
  #if defined(MAP_LOCK_DIAGNOSTIC)
  	printf("locking map LK_EXCLUPGRADE: 0x%x\n", map); 
*** vm_page.c	Sat Aug 15 20:26:27 1998
--- vm_page.c.new	Sat Aug 15 22:10:23 1998
***************
*** 388,393 ****
--- 388,400 ----
  	register vm_pindex_t pindex;
  {
  	register struct pglist *bucket;
+ #ifdef DIAGNOSTIC
+ 	register vm_page_t dm;
+ 
+ 	dm = vm_page_lookup(object, pindex);
+ 	if (dm)
+ 		panic("vm_page_insert: insertion overwrites existing entry");
+ #endif
  
  #if !defined(MAX_PERF)
  	if (m->flags & PG_TABLED)
***************
*** 1071,1076 ****
--- 1078,1085 ----
  
  /*
   * helper routine for vm_page_free and vm_page_free_zero
+  *
+  * must be at splhigh
   */
  static int
  vm_page_freechk_and_unqueue(m)
*** vm_pageout.c	Mon Mar 30 09:56:58 1998
--- vm_pageout.c.new	Sat Aug 15 22:45:37 1998
***************
*** 530,536 ****
  	vm_map_entry_t tmpe;
  	vm_object_t obj, bigobj;
  
! 	if (lockmgr(&map->lock, LK_EXCLUSIVE | LK_NOWAIT, (void *)0, curproc)) {
  		return;
  	}
  
--- 530,537 ----
  	vm_map_entry_t tmpe;
  	vm_object_t obj, bigobj;
  
! 	if (vm_map_lock_try(map)) {
! 		/* failed to obtain lock */
  		return;
  	}
  
----------------------------------------------------------------------------

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



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