PERFORCE change 90671 for review

Alan Cox alc at FreeBSD.org
Mon Jan 30 00:08:54 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=90671

Change 90671 by alc at alc_home on 2006/01/30 08:08:25

	Disentangle my diagnostics from INVARIANTS.

Affected files ...

.. //depot/projects/superpages/src/sys/amd64/amd64/pmap.c#7 edit

Differences ...

==== //depot/projects/superpages/src/sys/amd64/amd64/pmap.c#7 (text+ko) ====

@@ -145,6 +145,8 @@
 #include <machine/smp.h>
 #endif
 
+#define	DPRINTF(x)	do { if (0) printf x; } while (0)
+
 #ifndef PMAP_SHPGPERPROC
 #define PMAP_SHPGPERPROC 200
 #endif
@@ -1734,18 +1736,14 @@
 		 */
 		if ((ptpaddr & PG_PS) != 0) {
 			if (sva + NBPDR == va_next && eva >= va_next) {
-#ifdef	INVARIANTS
-				printf("pmap_remove: superpage at %lx to destroy.\n",
-				    sva);
-#endif
+				DPRINTF(("pmap_remove: superpage at %lx to destroy.\n",
+				    sva));
 				pmap_remove_pde(pmap, pde, sva);
 				anyvalid = 1;
 				continue;
 			} else {
-#ifdef	INVARIANTS
-				printf("pmap_remove: superpage at %lx to demote !!!\n",
-				    sva);
-#endif
+				DPRINTF(("pmap_remove: superpage at %lx to demote !!!\n",
+				    sva));
 				if (!pmap_demote(pmap, pde, sva)) {
 					anyvalid = 1;	/* XXX */
 					continue;
@@ -1815,7 +1813,7 @@
 		pmap->pm_stats.resident_count--;
 		pde = pmap_pde(pmap, pv->pv_va);
 		if (*pde & PG_PS) {
-			printf("pmap_remove_all: superpage to demote !!!\n");
+			DPRINTF(("pmap_remove_all: superpage to demote !!!\n"));
 			if (!pmap_demote(pmap, pde, pv->pv_va)) {
 				/*
 				 * All mappings within the same 2mpage were
@@ -2198,9 +2196,7 @@
 	     m->object == kernel_object || (m->object == kmem_object && FALSE)) &&
 	    m->reserv != NULL &&
 	    m->reserv->refcnt == NBPDR / PAGE_SIZE) {
-#ifdef	INVARIANTS
-		printf("%s: pmap %p va %lx XXX\n", __func__, pmap, va);
-#endif
+		DPRINTF(("%s: pmap %p va %lx XXX\n", __func__, pmap, va));
 		KASSERT(m->object->flags & OBJ_SUPERPAGES, ("pmap_enter: xxx"));
 		mach_promote(pmap, pmap_pde(pmap, va), m->reserv);
 	}
@@ -2329,9 +2325,7 @@
 	if (m->reserv != NULL &&
 	    m->reserv->refcnt == NBPDR / PAGE_SIZE &&
 	    mpte->wire_count == NPTEPG) {
-#ifdef	INVARIANTS
-		printf("%s: pmap %p va %lx XXX\n", __func__, pmap, va);
-#endif
+		DPRINTF(("%s: pmap %p va %lx XXX\n", __func__, pmap, va));
 		KASSERT(m->object->flags & OBJ_SUPERPAGES,
 		    ("pmap_enter_quick: xxx"));
 		mach_promote(pmap, pmap_pde(pmap, va), m->reserv);
@@ -2759,18 +2753,14 @@
 			}
 			if (sva <= trunc_2mpage(pv->pv_va) &&
 			    eva >= round_2mpage(pv->pv_va + 1)) {
-#ifdef	INVARIANTS
-				printf("pmap_remove_pages: superpage at %lx to destroy.\n",
-				    trunc_2mpage(pv->pv_va));
-#endif
+				DPRINTF(("pmap_remove_pages: superpage at %lx to destroy.\n",
+				    trunc_2mpage(pv->pv_va)));
 				pmap_remove_pde(pmap, pde, trunc_2mpage(pv->pv_va));
 				npv = TAILQ_FIRST(&pmap->pm_pvlist);
 				continue;
 			}
-#ifdef	INVARIANTS
-			printf("pmap_remove_pages: superpage at %lx to demote !!!\n",
-			    pv->pv_va);
-#endif
+			DPRINTF(("pmap_remove_pages: superpage at %lx to demote !!!\n",
+			    pv->pv_va));
 			if (!pmap_demote(pmap, pde, pv->pv_va)) {
 				/*
 				 * All mappings within the same 2mpage were
@@ -2930,7 +2920,7 @@
 		PMAP_LOCK(pmap);
 		pde = pmap_pde(pmap, pv->pv_va);
 		if (*pde & PG_PS) {
-			printf("pmap_clear_ptes: superpage to demote !!!\n");
+			DPRINTF(("pmap_clear_ptes: superpage to demote !!!\n"));
 			if ((*pde & bit) == 0 ||
 			    !pmap_demote(pmap, pde, pv->pv_va)) {
 				/*
@@ -3294,9 +3284,7 @@
 		atomic_subtract_int(&cnt.v_wire_count, 1);
 	}
 
-#ifdef	INVARIANTS
-	printf("Promotion successful XXX\n");
-#endif
+	DPRINTF(("Promotion successful XXX\n"));
 }
 
 static boolean_t


More information about the p4-projects mailing list