Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Sep 2009 11:49:11 -0500 (CDT)
From:      Mark Tinguely <tinguely@casselton.net>
To:        freebsd-arm@freebsd.org
Subject:   remove dangling allocations
Message-ID:  <200909021649.n82GnBb1072783@casselton.net>

next in thread | raw e-mail | index | archive | help

Without the pressure of getting something to work for FreeBSD 8.0, I would
like to revisit this issue.

Revisions 181296 and 195779 added cache fixes, and I think we should
also remove a couple dangling allocations.

Without removing the dangling allocation, the next time we map that page,
our cache fixing code will think these pages are still used somewhere else
and will unnecessarially turn off caching. As the system runs for days,
more and more pages could dangle and performance could suffer.

Removing the dangling allocation, may allow future simplification of the
cache fixing code.

Index: arm/arm/vm_machdep.c

===================================================================
--- arm/arm/vm_machdep.c	(revision 196359)
+++ arm/arm/vm_machdep.c	(working copy)
@@ -172,6 +172,9 @@ sf_buf_free(struct sf_buf *sf)
 	 if (sf->ref_count == 0) {
 		 TAILQ_INSERT_TAIL(&sf_buf_freelist, sf, free_entry);
 		 nsfbufsused--;
+		 pmap_kremove(sf->kva);
+		 sf->m = NULL;
+		 LIST_REMOVE(sf, list_entry);
 		 if (sf_buf_alloc_want > 0)
 			 wakeup_one(&sf_buf_freelist);
 	 }
@@ -452,9 +455,12 @@ arm_unmap_nocache(void *addr, vm_size_t size)
 
 	size = round_page(size);
 	i = (raddr - arm_nocache_startaddr) / (PAGE_SIZE);
-	for (; size > 0; size -= PAGE_SIZE, i++)
+	for (; size > 0; size -= PAGE_SIZE, i++) {
 		arm_nocache_allocated[i / BITS_PER_INT] &= ~(1 << (i % 
 		    BITS_PER_INT));
+		pmap_kremove(raddr);
+		raddr += PAGE_SIZE;
+	}
 }
 
 #ifdef ARM_USE_SMALL_ALLOC



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