From owner-freebsd-arm@FreeBSD.ORG Wed Sep 2 16:49:12 2009 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F22E106568D for ; Wed, 2 Sep 2009 16:49:12 +0000 (UTC) (envelope-from tinguely@casselton.net) Received: from casselton.net (casselton.net [63.165.140.2]) by mx1.freebsd.org (Postfix) with ESMTP id 4A6A08FC14 for ; Wed, 2 Sep 2009 16:49:12 +0000 (UTC) Received: from casselton.net (localhost [127.0.0.1]) by casselton.net (8.14.3/8.14.3) with ESMTP id n82GnBK3072784 for ; Wed, 2 Sep 2009 11:49:11 -0500 (CDT) (envelope-from tinguely@casselton.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=casselton.net; s=ccnMail; t=1251910151; bh=C2aBaDp3bNY5uijqysp5k65/gHjaAR8ggusHGJfVWg0=; h=Date:From:Message-Id:To:Subject; b=VU0rpMJP/fcYMbfWHi387zSA75Ro6I9id/WtqW6JA2If/XGdy5ZO5qA/OxTr6krKc xnOfMVQWSDebXyeVsII0+0iKe7vIv551LruDfx7UwvXaUO90w8NgWtZIB6Gp+odNDu PGVUxaXpz8xju1mWbNasF96MjgYOJfkqMFk1bl6g= Received: (from tinguely@localhost) by casselton.net (8.14.3/8.14.2/Submit) id n82GnBb1072783 for freebsd-arm@freebsd.org; Wed, 2 Sep 2009 11:49:11 -0500 (CDT) (envelope-from tinguely) Date: Wed, 2 Sep 2009 11:49:11 -0500 (CDT) From: Mark Tinguely Message-Id: <200909021649.n82GnBb1072783@casselton.net> To: freebsd-arm@freebsd.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.2 (casselton.net [127.0.0.1]); Wed, 02 Sep 2009 11:49:11 -0500 (CDT) Subject: remove dangling allocations X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Sep 2009 16:49:12 -0000 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