Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Jul 2006 10:44:54 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        Peter Jeremy <peterjeremy@optushome.com.au>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: contiguous memory allocation problem
Message-ID:  <200607011044.54872.hselasky@c2i.net>
In-Reply-To: <20060630203226.GG734@turion.vk2pj.dyndns.org>
References:  <200605271102.19799.hselasky@c2i.net> <200606302029.28563.hselasky@c2i.net> <20060630203226.GG734@turion.vk2pj.dyndns.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 30 June 2006 22:32, Peter Jeremy wrote:
> On Fri, 2006-Jun-30 20:29:28 +0200, Hans Petter Selasky wrote:
> >I sometimes see that the USB driver is unable to allocate contiguous
> > memory for itself. For example I noticed that FreeBSD was unable to
> > allocate 350kbytes of contiguous memory after that I had run "konqueror",
> > the KDE web browser and various other memory consuming applications for a
> > while.
>
> I reported this about 18 months ago and I'm fairly certain you even
> contributed to the thread at the time.
>
> >Any comments?
>
> The latest concensus seems to be that the USB system should make use of
> the scatter-gather facilities in the hardware to avoid the need to
> allocate large contiguous memory chunks.  iedowse@ had mostly finished
> implementing this in mid May.

Yes, but scatter and gather will add extra complexity to the driver, and maybe 
an extra memory copy in most cases. The idea is to allocate less than or 
equal to a page of memory, and then avoid the problem?

The most important thing is to keep memory allocations of constant size. For 
example under my USB system, all memory is allocated at attach. There is no 
longer allocation and freeing of memory during usage, with a few exceptions. 
I was thinking I could pre-allocate 2-4MB for the USB system, then make a 
list of freed memory blocks, and then search this list first, before 
allocating new memory.

Depending on how many different kinds of equipment one plugs, this should work 
fine.

What do you think?

--HPS



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