linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH ] kvm: x86: Reduce unnecessary function call
@ 2022-10-07 15:58 Hao Peng
  2022-10-07 17:04 ` Sean Christopherson
  0 siblings, 1 reply; 2+ messages in thread
From: Hao Peng @ 2022-10-07 15:58 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, linux-kernel

From: Peng Hao <flyingpeng@tencent.com>

kvm->lock is held very close to mutex_is_locked(kvm->lock).
Do not need to call mutex_is_locked.

Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
 arch/x86/kvm/pmu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
index 02f9e4f245bd..8a7dbe2c469a 100644
--- a/arch/x86/kvm/pmu.c
+++ b/arch/x86/kvm/pmu.c
@@ -601,8 +601,7 @@ int kvm_vm_ioctl_set_pmu_event_filter(struct kvm
*kvm, void __user *argp)
        sort(&filter->events, filter->nevents, sizeof(__u64), cmp_u64, NULL);

        mutex_lock(&kvm->lock);
-       filter = rcu_replace_pointer(kvm->arch.pmu_event_filter, filter,
-                                    mutex_is_locked(&kvm->lock));
+       filter = rcu_replace_pointer(kvm->arch.pmu_event_filter, filter, 1);
        mutex_unlock(&kvm->lock);

        synchronize_srcu_expedited(&kvm->srcu);
--
2.27.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-07 17:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-07 15:58 [PATCH ] kvm: x86: Reduce unnecessary function call Hao Peng
2022-10-07 17:04 ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).