On Mon, 19 Aug 2013, Ming Lei wrote:

> > As far as I can see, this counter does not need to be exact.  Why not
> > simply make it a non-atomic unsigned int?
> 
> It may becomes quite inaccurate, and 4.1 of the perfbook mentioned
> that half of counts might be lost with simple non-atomic unsigned int,
> so I think percpu variable is good choice.

In practice I think that is very unlikely to happen.  There would have 
to be separate threads running on different CPUs, simultaneously 
submitting URBs for the same device and very closely synchronized.

Also, we don't know how this number gets used.  Quite possibly, losing 
half of the counts won't matter very much -- maybe the user cares only 
about the order of magnitude.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to