Messages in this thread | | | Date | Tue, 6 Nov 2018 21:26:58 +0100 | From | Greg KH <> | Subject | Re: [PATCH] driver core: Add branch prediction hints in really_probe() |
| |
On Tue, Nov 06, 2018 at 09:46:30PM +0800, Muchun Song wrote: > If condition is false in most cases. So, add an unlikely() to the if > condition, so that the optimizer assumes that the condition is false. > > Signed-off-by: Muchun Song <smuchun@gmail.com>
As Rafael said, don't do stuff like this unless you can actually measure the difference. Last time we tested the kernel for this a few years ago, about 75% of the unlikely/likely additions were incorrect, removing them made the kernel faster. Turns out the compiler and cpu know better than developers do :)
Also, the probe() path is never a hot-path to worry about stuff like this.
thanks,
greg k-h
| |