Message ID | 1478991755-28153-3-git-send-email-sagi@grimberg.me (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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);
Signed-off-by: Sagi Grimberg <sagi@grimberg.me> --- lib/irq_poll.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)