All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] kvmppc: optimize find first bit
@ 2008-10-10 10:59 ehrhardt
  2008-10-10 18:23 ` Hollis Blanchard
  2008-10-13 12:07 ` ehrhardt
  0 siblings, 2 replies; 3+ messages in thread
From: ehrhardt @ 2008-10-10 10:59 UTC (permalink / raw)
  To: kvm-ppc

From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>

Since we use a unsigned long here anyway we can use the optimized __ffs.

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
---

[diffstat]

[diff]

diff --git a/arch/powerpc/kvm/booke_guest.c b/arch/powerpc/kvm/booke_guest.c
--- a/arch/powerpc/kvm/booke_guest.c
+++ b/arch/powerpc/kvm/booke_guest.c
@@ -227,7 +227,7 @@
 	unsigned long *pending = &vcpu->arch.pending_exceptions;
 	unsigned int priority;
 
-	priority = find_first_bit(pending, BITS_PER_BYTE * sizeof(*pending));
+	priority = __ffs(*pending);
 	while (priority <= BOOKE_MAX_INTERRUPT) {
 		if (kvmppc_can_deliver_interrupt_by_prio(vcpu, priority)) {
 			kvmppc_clear_exception_by_prio(pending, priority);

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

* Re: [PATCH 3/3] kvmppc: optimize find first bit
  2008-10-10 10:59 [PATCH 3/3] kvmppc: optimize find first bit ehrhardt
@ 2008-10-10 18:23 ` Hollis Blanchard
  2008-10-13 12:07 ` ehrhardt
  1 sibling, 0 replies; 3+ messages in thread
From: Hollis Blanchard @ 2008-10-10 18:23 UTC (permalink / raw)
  To: kvm-ppc

On Fri, 2008-10-10 at 12:59 +0200, ehrhardt@linux.vnet.ibm.com wrote:
> From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
> 
> Since we use a unsigned long here anyway we can use the optimized __ffs.

Looks good.

-- 
Hollis Blanchard
IBM Linux Technology Center


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

* [PATCH 3/3] kvmppc: optimize find first bit
  2008-10-10 10:59 [PATCH 3/3] kvmppc: optimize find first bit ehrhardt
  2008-10-10 18:23 ` Hollis Blanchard
@ 2008-10-13 12:07 ` ehrhardt
  1 sibling, 0 replies; 3+ messages in thread
From: ehrhardt @ 2008-10-13 12:07 UTC (permalink / raw)
  To: kvm-ppc

From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>

Since we use a unsigned long here anyway we can use the optimized __ffs.

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
---

[diffstat]
 booke_guest.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

[diff]

diff --git a/arch/powerpc/kvm/booke_guest.c b/arch/powerpc/kvm/booke_guest.c
--- a/arch/powerpc/kvm/booke_guest.c
+++ b/arch/powerpc/kvm/booke_guest.c
@@ -180,7 +180,7 @@
 	unsigned int prio;
 	u32 mask;
 
-	prio = find_first_bit(pending, BITS_PER_BYTE * sizeof(*pending));
+	prio = __ffs(*pending);
 	while (prio <= BOOKE_MAX_INTERRUPT) {
 		if (kvmppc_can_deliver_interrupt_by_prio(vcpu, prio, &mask)) {
 			kvmppc_clear_exception_by_prio(pending, prio);

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

end of thread, other threads:[~2008-10-13 12:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-10 10:59 [PATCH 3/3] kvmppc: optimize find first bit ehrhardt
2008-10-10 18:23 ` Hollis Blanchard
2008-10-13 12:07 ` ehrhardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.