lkml.org 
[lkml]   [2018]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] KVM: x86: Reduce retpoline performance impact in slot_handle_level_range()
> Either way, that does look like a reasonable answer. I had looked at
> the various one-line wrappers around slot_handle_level_range() and
> thought "hm, those should be inline", but I hadn't made the next step
> and pondered putting the whole thing inline. We'll give it a spin and
> work out where the next performance bottleneck is. Thanks.

In addition the problem with switch() is that gcc might decide in some
cases that the best way to implement your switch is an indirect call
from a lookup table.

For the simple case how about wrapping the if into

call_likely(foo->bar, usualfunction, args)

as a companion to

foo->bar(args)

that can resolve to nothing special on architectures that don't need it,
an if/else case on platforms with spectre, and potentially clever
stuff on any platform where you can beat the compiler by knowing
probabilities it can't infer ?

Alan


\
 
 \ /
  Last update: 2018-02-02 22:24    [W:0.107 / U:0.868 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site