Re: [PATCH v3 13/35] KVM: x86: hyper-v: optimize and cleanup kvm_hv_process_stimers()

From: Sean Christopherson
Date: Tue Dec 12 2023 - 12:22:42 EST


On Mon, Dec 11, 2023, Yury Norov wrote:
> The function traverses stimer_pending_bitmap in a for-loop bit by bit.
> Simplify it by using atomic find_and_set_bit().

for_each_test_and_clear_bit(), not find_and_set_bit().

It might also be nice to call out that there are only 4 bits, i.e. that using
for_each_test_and_clear_bit() will still generate inline code. Definitely not
mandatory though, just nice to have (I highly doubt this code would be sensitive
to using less optimal code).

> While here, refactor the logic by decreasing indentation level.
>
> CC: Sean Christopherson <seanjc@xxxxxxxxxx>
> Signed-off-by: Yury Norov <yury.norov@xxxxxxxxx>
> Reviewed-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
> ---
> arch/x86/kvm/hyperv.c | 40 ++++++++++++++++++++--------------------

This doesn't conflict with any of the in-flight Hyper-V changes, so with a fixed
changelog, feel free to take this through the bitmap tree.

Acked-by: Sean Christopherson <seanjc@xxxxxxxxxx>