2023-04-18 22:01:30

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH 1/2] KVM: arm64: Slightly optimize flush_context()

bitmap_zero() is faster than bitmap_clear(), so use it to save a few
cycles.

Signed-off-by: Christophe JAILLET <[email protected]>
---
arch/arm64/kvm/vmid.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kvm/vmid.c b/arch/arm64/kvm/vmid.c
index 08978d0672e7..bbf0677cfefa 100644
--- a/arch/arm64/kvm/vmid.c
+++ b/arch/arm64/kvm/vmid.c
@@ -47,7 +47,7 @@ static void flush_context(void)
int cpu;
u64 vmid;

- bitmap_clear(vmid_map, 0, NUM_USER_VMIDS);
+ bitmap_zero(vmid_map, NUM_USER_VMIDS);

for_each_possible_cpu(cpu) {
vmid = atomic64_xchg_relaxed(&per_cpu(active_vmids, cpu), 0);
--
2.34.1


2023-04-21 12:54:25

by Marc Zyngier

[permalink] [raw]
Subject: Re: [PATCH 1/2] KVM: arm64: Slightly optimize flush_context()

On Tue, 18 Apr 2023 23:47:37 +0200, Christophe JAILLET wrote:
> bitmap_zero() is faster than bitmap_clear(), so use it to save a few
> cycles.

Applied to next, thanks!

[1/2] KVM: arm64: Slightly optimize flush_context()
commit: 4be8ddb48b1b6c6067fb59c846b9c6e19d6efe14
[2/2] KVM: arm64: Use the bitmap API to allocate bitmaps
commit: a00e9e4319c2a8a8b166da028292de83190e39a4

Cheers,

M.
--
Without deviation from the norm, progress is not possible.