[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZDA+WdiqB2931xHB@google.com>
Date: Fri, 7 Apr 2023 09:01:29 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Bagas Sanjaya <bagasdotme@...il.com>
Cc: Kautuk Consul <kconsul@...ux.vnet.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Fabiano Rosas <farosas@...ux.ibm.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Chao Peng <chao.p.peng@...ux.intel.com>,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: PPC: BOOK3S: book3s_hv_nested.c: improve branch
prediction for k.alloc
On Fri, Apr 07, 2023, Bagas Sanjaya wrote:
> On Fri, Apr 07, 2023 at 05:31:47AM -0400, Kautuk Consul wrote:
> > I used the unlikely() macro on the return values of the k.alloc
> > calls and found that it changes the code generation a bit.
> > Optimize all return paths of k.alloc calls by improving
> > branch prediction on return value of k.alloc.
Nit, this is improving code generation, not branch prediction.
> What about below?
>
> "Improve branch prediction on kmalloc() and kzalloc() call by using
> unlikely() macro to optimize their return paths."
Another nit, using unlikely() doesn't necessarily provide a measurable optimization.
As above, it does often improve code generation for the happy path, but that doesn't
always equate to improved performance, e.g. if the CPU can easily predict the branch
and/or there is no impact on the cache footprint.
Powered by blists - more mailing lists