From: Gleb Natapov <gleb@redhat.com>
To: avi@redhat.com
Cc: Sheng Yang <sheng@linux.intel.com>, kvm@vger.kernel.org
Subject: [PATCH] use bitmap ops on a bitmap instead of bit ops
Date: Thu, 26 Feb 2009 15:03:39 +0200 [thread overview]
Message-ID: <20090226130339.GG8810@redhat.com> (raw)
And don't zero bitmap twice. Assume that caller zeros it.
Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index 7c2cb2b..21627b9 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -170,12 +170,11 @@ void kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
ioapic_debug("dest %d dest_mode %d\n", dest, dest_mode);
- *mask = 0;
if (dest_mode == 0) { /* Physical mode. */
if (dest == 0xFF) { /* Broadcast. */
for (i = 0; i < KVM_MAX_VCPUS; ++i)
if (kvm->vcpus[i] && kvm->vcpus[i]->arch.apic)
- *mask |= 1 << i;
+ __set_bit(i, *mask);
return;
}
for (i = 0; i < KVM_MAX_VCPUS; ++i) {
@@ -184,7 +183,7 @@ void kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
continue;
if (kvm_apic_match_physical_addr(vcpu->arch.apic, dest)) {
if (vcpu->arch.apic)
- *mask = 1 << i;
+ __set_bit(i, *mask);
break;
}
}
@@ -195,7 +194,7 @@ void kvm_ioapic_get_delivery_bitmask(struct kvm_ioapic *ioapic, u8 dest,
continue;
if (vcpu->arch.apic &&
kvm_apic_match_logical_addr(vcpu->arch.apic, dest))
- *mask |= 1 << vcpu->vcpu_id;
+ __set_bit(i, *mask);
}
ioapic_debug("mask %x\n", *mask);
}
--
Gleb.
next reply other threads:[~2009-02-26 13:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-26 13:03 Gleb Natapov [this message]
2009-02-27 3:19 ` [PATCH] use bitmap ops on a bitmap instead of bit ops Sheng Yang
2009-02-27 13:26 ` Gleb Natapov
2009-03-02 7:12 ` Sheng Yang
2009-03-03 1:28 ` Sheng Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090226130339.GG8810@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=sheng@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox