Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 09 Jan 1999 17:30:03 +0300
From:      Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
To:        Stephen McKay <syssgm@dtir.qld.gov.au>
Cc:        Dmitrij Tejblum <dt@FreeBSD.ORG>, cvs-committers@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/i386/i386 pmap.c 
Message-ID:  <199901091430.RAA00524@tejblum.dnttm.rssi.ru>
In-Reply-To: Your message of "Sat, 09 Jan 1999 23:59:13 %2B1000." <199901091359.XAA22824@nymph.dtir.qld.gov.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
Stephen McKay wrote:
> On Thursday, 7th January 1999, Dmitrij Tejblum wrote:
> 
> >dt          1999/01/07 14:15:52 PST
> >
> >  Modified files:
> >    sys/i386/i386        pmap.c 
> >  Log:
> >  Make pmap_ts_referenced check more than 1 pv_entry. (One should be carefull
> >  when move elements to the tail of a list in a loop...)
> >  
> >  Revision  Changes    Path
> >  1.216     +5 -5      src/sys/i386/i386/pmap.c
> 
> So it's now a big NOP instead of executing the loop once.

Ahh! That is because I made the patch month or two ago, and "simplified"
it before commit, when already forgot it ;-/ My original patch appears 
to be more correct: (btw, I run it on 4 production servers all the 
time, and didn't notice degradation...)

--- pmap.c	Sat Dec 12 12:58:24 1998
+++ pmap.c	Sat Dec 12 13:38:40 1998
@@ -3205,7 +3205,7 @@
 int
 pmap_ts_referenced(vm_offset_t pa)
 {
-	register pv_entry_t pv;
+	register pv_entry_t pv, pvf, pvn;
 	pv_table_t *ppv;
 	unsigned *pte;
 	int s;
@@ -3226,9 +3226,11 @@
 	/*
 	 * Not found, check current mappings returning immediately if found.
 	 */
-	for (pv = TAILQ_FIRST(&ppv->pv_list);
-		pv;
-		pv = TAILQ_NEXT(pv, pv_list)) {
+	pvf = 0;
+	for (pv = TAILQ_FIRST(&ppv->pv_list); pv && pv != pvf; pv = pvn) {
+		if (!pvf)
+			pvf = pv;
+		pvn = TAILQ_NEXT(pv, pv_list);
 
 		TAILQ_REMOVE(&ppv->pv_list, pv, pv_list);
 		/*


Thanks for pointiong it out!

> There's no need for all that removing and inserting anyway.  Zap it and
> the bugs will depart for other dark parts of the code.

Well, I think since the code was added in March 1998 or so as an optimization, 
it should make some sense, right?

Dima



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



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