From owner-freebsd-hackers Wed Mar 13 12:20:51 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from web.cs.ndsu.nodak.edu (web.cs.ndsu.NoDak.edu [134.129.125.7]) by hub.freebsd.org (Postfix) with ESMTP id D7C0837B404 for ; Wed, 13 Mar 2002 12:19:53 -0800 (PST) Received: (from tinguely@localhost) by web.cs.ndsu.nodak.edu (8.11.4/8.11.4) id g2DKJl514183; Wed, 13 Mar 2002 14:19:47 -0600 (CST) (envelope-from tinguely) Date: Wed, 13 Mar 2002 14:19:47 -0600 (CST) From: mark tinguely Message-Id: <200203132019.g2DKJl514183@web.cs.ndsu.nodak.edu> To: freebsd-hackers@FreeBSD.ORG, gjohnson@research.canon.com.au Subject: Re: DMA memory allocation/deallocation In-Reply-To: <20020313000243.0B01F540D0@brixi.research.canon.com.au> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > I am having some memory allocation woes in my FreeBSD kernel > device driver. I allocate DMAable memory with something like: > > retval = bus_dma_tag_create ... > (1 << 20), > 1, > (1 << 20), ... > which seems to succeed/work. But when I attempt to release the > allocated memory like this: > > bus_dmamap_unload(memtag, memmap); > > bus_dmamem_free(memtag, (void *) vaddr, memmap); > > bus_dmamap_destroy(memtag, memmap); > > bus_dma_tag_destroy(memtag); there was a contig_free bug that was squashed between 4.4 and 4.5, by Matt Dillon. If I remember correctly there is a slight leak if the contig_malloc failed, but that would not be your problem. it is possible that something else on the system is allocating at least single block in that now freed, but perfect sized chunk. as a result, the new allocation can no longer use that memory and has to search higher in RAM. try a few back to back bus_dmamem_alloc() and bus_dmamem_free() without any other operations and if that is sliding up in RAM there is a(nother) problem in the contiguous free...my guess it will operate normally and the problem is related to someone allocating a block and breaking up that nice contiguous chunk. --mark tinguely. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message