[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1004071157460.1779-100000@iolanthe.rowland.org>
Date: Wed, 7 Apr 2010 12:04:33 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Greg KH <greg@...ah.com>
cc: Daniel Mack <daniel@...aq.de>, <linux-kernel@...r.kernel.org>,
Pedro Ribeiro <pedrib@...il.com>, <akpm@...ux-foundation.org>,
Greg KH <gregkh@...e.de>, <alsa-devel@...a-project.org>,
<linux-usb@...r.kernel.org>
Subject: Re: USB transfer_buffer allocations on 64bit systems
On Wed, 7 Apr 2010, Greg KH wrote:
> > FWIW, most drivers I've seen in the past hours use a wild mix of
> > kmalloc(), kzalloc(), kcalloc() and usb_buffer_alloc(). That should
> > really be unified.
Well, kcalloc can easily be replaced by kzalloc, right? Or the
equivalent.
The extra overhead of initializing the memory to 0 isn't present in
kmalloc, so we need to maintain the distinction between kmalloc and
kzalloc.
However usb_buffer_alloc is fundmentally different from all the others.
> Yes, if it is necessary that we have to handle this type of crappy
> hardware, then it all needs to be unified. Or at least unified into 2
> types of calls, one that needs the bounce buffer fun (what
> usb_buffer_alloc() does today), and one that doesn't (usb_kzalloc()
> perhaps?)
usb_buffer_alloc has very little to do with bounce buffers. Its
purpose is to allocate dma-consistent memory, that it, memory which
does not need to be mapped for DMA before each I/O operation and
unmapped afterward.
The mapping and unmapping operations aren't extremely time consuming,
so in general it makes sense to avoid them only when the _same_ buffer
is going to be used for many I/O operations during a short period of
time. For instance, it makes sense for audio and video, where all the
data streams through a small set of buffers arranged in a ring.
But for most other uses it makes no sense. Especially since some
platforms have limited amounts of consistent memory available.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists