lkml.org 
[lkml]   [2016]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v7 06/11] x86, paravirt: Add interface to support kvm/xen vcpu preempted check
    On Wed, Nov 16, 2016 at 12:19:09PM +0800, Pan Xinhui wrote:
    > Hi, Peter.
    > I think we can avoid a function call in a simpler way. How about below
    >
    > static inline bool vcpu_is_preempted(int cpu)
    > {
    > /* only set in pv case*/
    > if (pv_lock_ops.vcpu_is_preempted)
    > return pv_lock_ops.vcpu_is_preempted(cpu);
    > return false;
    > }

    That is still more expensive. It needs to do an actual load and makes it
    hard to predict the branch, you'd have to actually wait for the load to
    complete etc.

    Also, it generates more code.

    Paravirt muck should strive to be as cheap as possible when ran on
    native hardware.

    \
     
     \ /
      Last update: 2016-11-16 11:25    [W:3.693 / U:0.248 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site