Re: [PATCH] USB: core: remove CONFIG_USB_DEBUG usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 20, 2013 at 09:47:53PM -0500, Alan Stern wrote:
> On Fri, 20 Dec 2013, Greg Kroah-Hartman wrote:
> 
> > > >  	/* Check that the pipe's type matches the endpoint's type */
> > > >  	if (usb_pipetype(urb->pipe) != pipetypes[xfertype])
> > > 
> > > It looks as though it ought to be possible to make that check:
> > > 	if (unlikely(xfertype != urb->pipe->valid_xfertype))
> > 
> > You should almost never use unlikely() on your own, in a driver, as the
> > compiler should make better code without it.
> 
> Is that really true?  If it is, what point is there in having the 
> likely()/unlikely() macros in the first place?

At this point in time, with modern processors and the huge pipelines
that they have, almost nothing.  Andi Kleen did a bunch of benchmarks a
few years ago that show that removing them all makes things work better,
and we, as programmers, usually get the "guess" wrong.

Maybe, in the scheduler, or on a _very_ hot path in the kernel (like
locks), that can be properly benchmarked and validated, can they make a
difference.  But in USB, with our line speeds, it's not an issue.

greg k-h
--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux