Date: Fri, 26 Jun 2009 08:01:17 -0600 From: Scott Long <scottl@samsco.org> To: =?ISO-8859-2?Q?Piotr_Zi=EAcik?= <kosmo@semihalf.com> Cc: freebsd-current@freebsd.org Subject: Re: [PATCH RFC]: Bus_dma eats all available memory Message-ID: <4A44D4AD.8010307@samsco.org> In-Reply-To: <200906260929.40709.kosmo@semihalf.com> References: <200906251329.35200.kosmo@semihalf.com> <4A43C243.9000001@samsco.org> <200906260929.40709.kosmo@semihalf.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Piotr Ziêcik wrote: > Thursday 25 June 2009 20:30:27 Scott Long napisa³(a): >> Piotr Ziêcik wrote: >>> Hi >>> >>> While working on new driver for FreeBSD I have found a problem in bus_dma >>> subsystem. Every time when bus_dmamap_create() is called on bus_dma tag >>> using bounce zone, at least 1 page in bounce zone is allocated. This >>> causes eating of all avaible memory by bounce zone. Problem affects i386, >>> amd64 and arm. >> The code block that you point at can only be entered if the maxpages >> limit has not been reached. However, the max limit is per zone, not >> global, and there's no easy way to make it be global. Are you creating >> an excessive number of tags/zones? > > Driver creates one tag and and one map everytime when new request arrives. > Both are freed after processing. Driver can queue maximum 64 requests, so > it there will not be more than 64 tags and 64 maps. Debugging shows that the > limit is never reached and number of tags and maps is around 30 - 40. In my > oppinion this is not excessive number of tags. > Tags and maps should be allocated at driver initialization time, not every time a request comes in. The problem here isn't the MAX() test, it's that the MIN_ALLOC_COMP test is getting fooled because the tag keeps on getting recycled. The correct fix is likely to move the flag into the bounce zone object. But in general, you should not be allocating and freeing tags and maps so often, they are meant to have a long lifespan. Scott
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A44D4AD.8010307>