[lkml]   [2018]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [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 <>

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


greg k-h

 \ /
  Last update: 2018-11-06 21:27    [W:0.092 / U:2.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site