lkml.org 
[lkml]   [2022]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2] x86/paravirt: useless assignment instructions cause Unixbench full core performance degradation
From
On 6/27/22 01:54, Guo Hui wrote:
> Thank you very much Longman, my patch is as you said, only disable
> node_cpu on X86, enable node_cpu on arm64, powerpc, s390 architectures;
> the code is in file arch/x86/kernel/paravirt-spinlocks.c:
>     DECLARE_STATIC_KEY_FALSE(preemted_key);
>     static_branch_enable(&preemted_key);
>
> the default value of preemted_key is false and the if conditional
> statement is reversed,
> the code is in file kernel/locking/osq_lock.c:
>     DEFINE_STATIC_KEY_FALSE(preemted_key);
>
>     static inline int node_cpu(struct optimistic_spin_node *node)
>     {
>         int cpu = 0;
>
>         if (!static_branch_unlikely(&preemted_key))
>             cpu = node->cpu - 1;
>
>         return cpu;
>   }
>
> In this way, only one nop instruction is added to architectures arm64,
> powerpc and s390, including virtual machines, without any other changes.

You are right. I am probably too tired last night to read the patch more
carefully.

Cheers,
Longman

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