Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Mar 2006 23:43:17 GMT
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 93380 for review
Message-ID:  <200603152343.k2FNhHBN005065@repoman.freebsd.org>

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

Change 93380 by peter@peter_melody on 2006/03/15 23:43:08

	Slight optimization.  If we're going to test the map for nonzero, use
	that to terminate the loop.  Use the loop termination condition to measure
	success.

Affected files ...

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

Differences ...

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

@@ -1593,13 +1593,12 @@
 	pc = TAILQ_FIRST(&pmap->pm_pvchunk);
 	if (pc != NULL) {
 		for (field = 0; field < _NPCM; field++) {
-			bit = -1;
-			if (pc->pc_map[field])
+			if (pc->pc_map[field]) {
 				bit = bsfq(pc->pc_map[field]);
-			if (bit >= 0)
 				break;
+			}
 		}
-		if (bit >= 0) {
+		if (field < _NPCM) {
 			pv = &pc->pc_pventry[field * 64 + bit];
 			pc->pc_map[field] &= ~(1ul << bit);
 			/* If this was the last item, move it to tail */



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