Re: [PATCH 2/3] irq-poll: micro optimize some branch predictions

2016-11-13 Thread Sagi Grimberg

Are they really that unlikely?  I don't like these annotations unless
it's clearly an error path or they have a high, demonstrable benefit.


IRQ_POLL_F_DISABLE is set when disabling the iop (in the end of the
world). IRQ_POLL_F_SCHED is set on irq_poll_sched() itself so this cond
would match only if the user called irq_poll_sched() twice which it
shouldn't ever do.

So yes, I think these are really unlikely()

But now I noticed that I typo'ed the IRQ_POLL_F_SCHED from
unlikely to likely :(

need to fix that...
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] irq-poll: micro optimize some branch predictions

2016-11-13 Thread Christoph Hellwig
Are they really that unlikely?  I don't like these annotations unless
it's clearly an error path or they have a high, demonstrable benefit.
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] irq-poll: micro optimize some branch predictions

2016-11-12 Thread Sagi Grimberg
Signed-off-by: Sagi Grimberg 
---
 lib/irq_poll.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/irq_poll.c b/lib/irq_poll.c
index 22d033e6ded2..44a5d1da4260 100644
--- a/lib/irq_poll.c
+++ b/lib/irq_poll.c
@@ -26,9 +26,9 @@ void irq_poll_sched(struct irq_poll *iop)
 {
unsigned long flags;
 
-   if (test_bit(IRQ_POLL_F_DISABLE, &iop->state))
+   if (unlikely(test_bit(IRQ_POLL_F_DISABLE, &iop->state)))
return;
-   if (test_and_set_bit(IRQ_POLL_F_SCHED, &iop->state))
+   if (likely(test_and_set_bit(IRQ_POLL_F_SCHED, &iop->state)))
return;
 
local_irq_save(flags);
@@ -120,7 +120,7 @@ static void __latent_entropy irq_poll_softirq(struct 
softirq_action *h)
 * move the instance around on the list at-will.
 */
if (work >= weight) {
-   if (test_bit(IRQ_POLL_F_DISABLE, &iop->state))
+   if (unlikely(test_bit(IRQ_POLL_F_DISABLE, &iop->state)))
__irq_poll_complete(iop);
else
list_move_tail(&iop->list, list);
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html