On Mon, Aug 19, 2013 at 11:17 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: > On Mon, 19 Aug 2013, Ming Lei wrote: > >> On Mon, Aug 19, 2013 at 10:42 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: >> > On Mon, 19 Aug 2013, Ming Lei wrote: >> > >> >> Because usb_hcd_submit_urb is in the hotest path of usb core, >> >> so use percpu counter to count URB instead of using atomic variable >> >> because atomic operations are much slower than percpu operations. >> > >> > This seems like a ridiculous amount of additional overhead for a simple >> > counter. The kernel doesn't even use this value for anything; it's >> > only purpose is to allow userspace to see how many URBs have been >> > transferred for a device. (I don't know what programs use this >> > information. Powertop maybe?) >> >> That is why I want to remove the expensive atomic inc/dec, or can we >> remove the counter? > > No doubt somebody would complain if the counter was removed. Who added > it in the first place, and for what reason? > >> > Do you have any reason to believe this will really improve performance >> > at all? >> >> Please see my reply on Greg's comments. > > 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. Thanks, -- Ming Lei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html