On Tue, Jun 26, 2018 at 05:31:40PM +0300, Nikolay Borisov wrote:
> 
> 
> On 26.06.2018 17:24, David Sterba wrote:
> > The v0 extent type checks are the right case for the unlikely
> > annotations as we don't expect to ever see them, so let's give the
> > compiler some hint.
> > 
> > Signed-off-by: David Sterba <dste...@suse.com>
> 
> The question is how helpful those unlikelies are in the generated code.

They typically lead to inverse condition (so the jump is not taken) and
the body of the loop is moved farther away.

> Also according to the comment about __cold annotation this already gives
> the compiler a hint that any code leading to such a cold function is
> already unlikely.

Yes, that's another hint. The condition annotation affects the whole
statement block regardless. I also think that the unlikely in this case
serves as a code documentation (as long as this is consistent with other
uses of likely/unlikely).
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to