Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Mar 2006 23:18:10 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 93320 for review
Message-ID:  <200603142318.k2ENIAaP094292@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=93320

Change 93320 by peter@peter_daintree on 2006/03/14 23:18:05

	Add some temporary bandaids to get back to single user

Affected files ...

.. //depot/projects/hammer/sys/amd64/amd64/pmap.c#137 edit

Differences ...

==== //depot/projects/hammer/sys/amd64/amd64/pmap.c#137 (text+ko) ====

@@ -1482,12 +1482,12 @@
 			pte = pmap_pte_pde(pmap, va, &ptepde);
 			tpte = pte_load_clear(pte);
 			KASSERT((tpte & PG_W) == 0,
-			    ("get_pv_entry: wired pte %#lx", tpte));
+			    ("pmap_collect: wired pte %#lx", tpte));
 			if (tpte & PG_A)
 				vm_page_flag_set(m, PG_REFERENCED);
 			if (tpte & PG_M) {
 				KASSERT((tpte & PG_RW),
-	("get_pv_entry: modified page not writable: va: %#lx, pte: %#lx",
+	("pmap_collect: modified page not writable: va: %#lx, pte: %#lx",
 				    va, tpte));
 				if (pmap_track_modified(va))
 					vm_page_dirty(m);
@@ -1557,14 +1557,18 @@
 	if (pv_entry_count > pv_entry_high_water)
 		pagedaemon_wakeup();
 	pc = TAILQ_FIRST(&pmap->pm_pvchunk);
+	if (pc == NULL)
+		goto alloc;
 	for (field = 0; field < _NPCM; field++) {
-		bit = bsrq(pc->pc_map[field]);
+		bit = -1;
+		if (pc->pc_map[field])
+			bit = bsfq(pc->pc_map[field]);
 		if (bit >= 0)
 			break;
 	}
 	if (bit >= 0) {
 		pv = &pc->pc_pventry[field * 64 + bit];
-		pc->pc_map[field] &= (1ul << bit);
+		pc->pc_map[field] &= ~(1ul << bit);
 		/* If this was the last item, move it to tail */
 		if (pc->pc_map[0] == 0 && pc->pc_map[1] == 0 &&
 		    pc->pc_map[2] == 0) {
@@ -1573,6 +1577,7 @@
 		}
 		return (pv);
 	}
+alloc:
 	/* No free items, allocate another chunk */
 	m = vm_page_alloc(NULL, colour, VM_ALLOC_SYSTEM | VM_ALLOC_NOOBJ);
 	if (m == NULL) {



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