lkml.org 
[lkml]   [2022]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm/page_alloc: make calling prep_compound_head more reliable
On Wed, Jun 15, 2022 at 03:44:06PM +0800, Miaohe Lin wrote:
> > We definitely don't need the unlikely here.
>
> Could you please give me a more detailed explanation? IIUC, the above if condition
> will only meet at a probability of 1/512. So unlikely tells the compiler to do some
> optimization around it. Or am I miss something?

Only add unlikely() when the compiler can't figure out for itself that
it's unlikely. You should also check the generated code and/or
benchmark the results to be sure that it's actually an improvement.
Using unlikely() needs to be backed up with more than just a feeling.

\
 
 \ /
  Last update: 2022-06-15 14:43    [W:0.047 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site