Date: Wed, 13 Mar 2002 14:19:47 -0600 (CST) From: mark tinguely <tinguely@web.cs.ndsu.nodak.edu> To: freebsd-hackers@FreeBSD.ORG, gjohnson@research.canon.com.au Subject: Re: DMA memory allocation/deallocation Message-ID: <200203132019.g2DKJl514183@web.cs.ndsu.nodak.edu> In-Reply-To: <20020313000243.0B01F540D0@brixi.research.canon.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203132019.g2DKJl514183>