linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sagi Grimberg <sagi@grimberg.me>
To: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Cc: Christoph Hellwig <hch@lst.de>
Subject: [PATCH 2/3] irq-poll: micro optimize some branch predictions
Date: Sun, 13 Nov 2016 01:02:34 +0200	[thread overview]
Message-ID: <1478991755-28153-3-git-send-email-sagi@grimberg.me> (raw)
In-Reply-To: <1478991755-28153-1-git-send-email-sagi@grimberg.me>

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 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

  parent reply	other threads:[~2016-11-12 23:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-12 23:02 [PATCH 0/3] micro-optimize irq-poll Sagi Grimberg
2016-11-12 23:02 ` [PATCH 1/3] irq-poll: Remove redundant include Sagi Grimberg
2016-11-13 15:12   ` Christoph Hellwig
2016-11-12 23:02 ` Sagi Grimberg [this message]
2016-11-13 15:13   ` [PATCH 2/3] irq-poll: micro optimize some branch predictions Christoph Hellwig
2016-11-14  0:49     ` Sagi Grimberg
2016-11-12 23:02 ` [PATCH 3/3] irq-poll: Reduce local_irq_save/restore operations in irq_poll_softirq Sagi Grimberg
2016-11-13 15:18   ` Christoph Hellwig
2016-11-14  1:02     ` Sagi Grimberg

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=1478991755-28153-3-git-send-email-sagi@grimberg.me \
    --to=sagi@grimberg.me \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).