Date: Sat, 1 Jul 2006 20:44:35 +0100 From: David Malone <dwmalone@maths.tcd.ie> To: Hans Petter Selasky <hselasky@c2i.net> Cc: freebsd-hackers@freebsd.org Subject: Re: contiguous memory allocation problem Message-ID: <20060701194435.GA30115@walton.maths.tcd.ie> In-Reply-To: <200607011044.54872.hselasky@c2i.net> References: <200605271102.19799.hselasky@c2i.net> <200606302029.28563.hselasky@c2i.net> <20060630203226.GG734@turion.vk2pj.dyndns.org> <200607011044.54872.hselasky@c2i.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jul 01, 2006 at 10:44:54AM +0200, Hans Petter Selasky wrote: > > 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? I believe the USB drivers in -current grew scatter/gather support about a month ago. See the commit message below. Is this likely to help? David. Use the limited scatter-gather capabilities of ehci, ohci and uhci host controllers to avoid the need to allocate any multi-page physically contiguous memory blocks. This makes it possible to use USB devices reliably on low-memory systems or when memory is too fragmented for contiguous allocations to succeed. The USB subsystem now uses bus_dmamap_load() directly on the buffers supplied by USB peripheral drivers, so this also avoids having to copy data back and forth before and after transfers. The ehci and ohci controllers support scatter/gather as long as the buffer is contiguous in the virtual address space. For uhci the hardware cannot handle a physical address discontinuity within a USB packet, so it is necessary to copy small memory fragments at times.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060701194435.GA30115>