x86/mm: Improve bitops in vcpumask_to_pcpumask()

This loop is for_each_set_bit() in disguise.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Andrew Cooper committed 2025-05-02 15:04:41 +01:00
1 parent ebd53a7492
commit 78ce2be733
1 file changed
+2 -4
+2 -4
View File
@@ -3411,7 +3411,7 @@ int new_guest_cr3(mfn_t mfn)
static int vcpumask_to_pcpumask(
struct domain *d, XEN_GUEST_HANDLE_PARAM(const_void) bmap, cpumask_t *pmask)
{
unsigned int vcpu_id, vcpu_bias, offs;
unsigned int vcpu_bias, offs;
unsigned long vmask;
struct vcpu *v;
bool is_native = !is_pv_32bit_domain(d);
@@ -3432,12 +3432,10 @@ static int vcpumask_to_pcpumask(
return -EFAULT;
}
while ( vmask )
for_each_set_bit ( vcpu_id, vmask )
{
unsigned int cpu;
vcpu_id = ffsl(vmask) - 1;
vmask &= ~(1UL << vcpu_id);
vcpu_id += vcpu_bias;
if ( (vcpu_id >= d->max_vcpus) )
return 0;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.