[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181106202658.GA26208@kroah.com>
Date: Tue, 6 Nov 2018 21:26:58 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Muchun Song <smuchun@...il.com>
Cc: rafael@...nel.org, linux-kernel@...r.kernel.org
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@...il.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
Powered by blists - more mailing lists