[alsa-devel] USB transfer_buffer allocations on 64bit systems

Takashi Iwai tiwai at suse.de
Wed Apr 7 20:06:06 CEST 2010


At Wed, 7 Apr 2010 19:59:35 +0200,
Daniel Mack wrote:
> 
> On Wed, Apr 07, 2010 at 07:55:20PM +0200, Takashi Iwai wrote:
> > At Wed, 7 Apr 2010 18:16:03 +0200,
> > Daniel Mack wrote:
> > > 
> > > On Wed, Apr 07, 2010 at 11:55:19AM -0400, Alan Stern wrote:
> > > > On Wed, 7 Apr 2010, Greg KH wrote:
> > > > 
> > > > > Alan, any objection to just using usb_buffer_alloc() for every driver?
> > > > > Or is that too much overhead?
> > > > 
> > > > I don't know what the overhead is.  But usb_buffer_alloc() requires the 
> > > > caller to keep track of the buffer's DMA address, so it's not a simple 
> > > > plug-in replacement.  In addition, the consistent memory that 
> > > > usb_buffer_alloc() provides is a scarce resource on some platforms.
> > > > 
> > > > Writing new functions is the way to go.
> > > 
> > > Ok, I'll write some dummies for usb_malloc() and usb_zalloc() which
> > > will just call kmalloc() with GFP_DMA32 for now.
> > 
> > Can't we provide only zalloc() variant?  Zero'ing doesn't cost much,
> > and the buffer allocation shouldn't be called too often.
> > 
> > > And while at it,
> > > usb_alloc_buffer() will be renamed to usb_alloc_consistent().
> > 
> > Most of recent functions are named with "coherent".
> 
> I agree to both points, will do so unless anyone has a harsh opinion
> about that.
> 
> Another thing: I guess we don't need a corresponding free() function
> that just calls kfree(), right? Or should we introduce it now to be
> flexible for future extensions?

Well, I would implement the corresponding free.  It could be simply
a macro calling kfree(), but it's saner to provide it for API
uniformity, IMO.


thanks,

Takashi


More information about the Alsa-devel mailing list