[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <561BA326.7060209@ladisch.de>
Date: Mon, 12 Oct 2015 14:10:14 +0200
From: Clemens Ladisch <clemens@...isch.de>
To: Felipe Tonello <eu@...ipetonello.com>
Cc: USB list <linux-usb@...r.kernel.org>,
Kernel development list <linux-kernel@...r.kernel.org>,
Peter Chen <Peter.Chen@...escale.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Felipe Balbi <balbi@...com>,
Andrzej Pietrasiewicz <andrzej.p@...sung.com>
Subject: Re: [PATCH v3 1/4] usb: gadget: f_midi: free usb request when done
Felipe Tonello wrote:
> On Mon, Oct 12, 2015 at 11:16 AM, Clemens Ladisch <clemens@...isch.de> wrote:
>> Felipe Tonello wrote:
>>> I believe that is the best way to implement. Create multiple requests
>>> until the ALSA substreams buffer are empty and free the request on
>>> completion.
>>
>> I believe a better way to implement this is to allocate a fixed number
>> of requests, and to always reuse them.
>
> How many?
Enough to get proper pipelining. At least two, maybe not more.
(Depends on how fast those tiny CPUs can queue the next request.)
>>> The problem of having requests when host isn't listening will happen
>>> anyway because there is no way to know that until completion.
>>
>> But if you have no upper limit on the number of queues requests, you
>> will eventually run out of (DMA) memory.
>
> And that's what happening at the moment. One of my patches are to fix
> a memory leak when that happens.
>
> But it would be ideal to have a FIFO of requests and perhaps ignore
> new requests if the FIFO is full.
>
> So, allocate (pre-allocate?) new requests until the FIFO is full. Upon
> completion, remove the request from FIFO, but still reuse it on
> f_midi_transmit() and queue it on the FIFO again if there is still
> data from ALSA, otherwise just free the request.
Yes, that's exactly what I'm proposing.
Regards,
Clemens
--
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