changeset 9986:4d51e0eb2206

6850428 freemem can end up being double decremented because of fix for CR 6666035
author David Valin <David.Valin@Sun.COM>
date Mon, 29 Jun 2009 06:20:33 -0700
parents f0a94a205b15
children f2e8d2b3f311
files usr/src/uts/common/vm/vm_page.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/vm/vm_page.c	Mon Jun 29 02:56:22 2009 -0700
+++ b/usr/src/uts/common/vm/vm_page.c	Mon Jun 29 06:20:33 2009 -0700
@@ -2939,6 +2939,12 @@
 			mutex_enter(&p->pcf_lock);
 			if (p->pcf_count >= 1) {
 				p->pcf_count -= 1;
+				/*
+				 * freemem is not protected by any lock. Thus,
+				 * we cannot have any assertion containing
+				 * freemem here.
+				 */
+				freemem -= 1;
 				enough = 1;
 				break;
 			}
@@ -2998,11 +3004,6 @@
 		}
 	}
 
-	/*
-	 * freemem is not protected by any lock. Thus, we cannot
-	 * have any assertion containing freemem here.
-	 */
-	freemem -= 1;
 
 	VM_STAT_ADD(pagecnt.pc_reclaim);