calculating ring buffer size

Greg KH greg at kroah.com
Mon Oct 17 10:58:15 EDT 2011


On Mon, Oct 17, 2011 at 03:31:02PM +0530, Amit Nagal wrote:
> Hi ,
> 
> While going through a few usb drivers code  , i observed that the
> drivers maintain a ring buffer
> which stores data coming from usb device in interrupt context .
> Also these ring buffers is a  power of  2 size
> 
> i am looking for reasons how to compute the the max size of these ring
> buffers , so that no overflow situation happens .
> What factors should always be accounted while computing the max size
> of these ring buffers .

Test your device, and your driver, with different values and determine
what is the best size.  It's not that hard to do.

greg k-h



More information about the Kernelnewbies mailing list