From patchwork Sat Nov 12 23:02:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 9424513 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4084D60512 for ; Sat, 12 Nov 2016 23:02:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34FEB28DB3 for ; Sat, 12 Nov 2016 23:02:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29CDD28DBA; Sat, 12 Nov 2016 23:02:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, URIBL_BLACK autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF10728DB3 for ; Sat, 12 Nov 2016 23:02:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751288AbcKLXCr (ORCPT ); Sat, 12 Nov 2016 18:02:47 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:36175 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751088AbcKLXCr (ORCPT ); Sat, 12 Nov 2016 18:02:47 -0500 Received: from [46.120.250.42] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.85_2 #1 (Red Hat Linux)) id 1c5hJt-0006aH-Ul; Sat, 12 Nov 2016 23:02:46 +0000 From: Sagi Grimberg To: Jens Axboe , linux-block@vger.kernel.org Cc: Christoph Hellwig Subject: [PATCH 2/3] irq-poll: micro optimize some branch predictions Date: Sun, 13 Nov 2016 01:02:34 +0200 Message-Id: <1478991755-28153-3-git-send-email-sagi@grimberg.me> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478991755-28153-1-git-send-email-sagi@grimberg.me> References: <1478991755-28153-1-git-send-email-sagi@grimberg.me> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);