From patchwork Fri Jan 19 16:58:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10175787 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 E1D9B60386 for ; Fri, 19 Jan 2018 16:59:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3472280FC for ; Fri, 19 Jan 2018 16:59:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C81712872E; Fri, 19 Jan 2018 16:59:00 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 746FD280FC for ; Fri, 19 Jan 2018 16:59:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755993AbeASQ67 (ORCPT ); Fri, 19 Jan 2018 11:58:59 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:46385 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756005AbeASQ66 (ORCPT ); Fri, 19 Jan 2018 11:58:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1516381138; x=1547917138; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=yAetuGKGz+/kvxr4x3RYMGoVkN0hsBfsb7W0WyWklDU=; b=VG/JAjkBz7g+Z65NvJgfopK4fGBbdGlHt0/7ASkrMJtn3Lb2MUd+U6g4 POoWaUeE9hqwMEbUFkHjGFdHKXIup3vQHbZRkQhqVLUADMUmSfNhQTvtp BRWWt+FHN2sFZr9crpsB4jgLHg1oS4XGk0be76fjmgUOEqx3/t68HereZ aKHdbe9YGko+2eXiTMB5hR6DyNN3avtfg+PEWulAtA6wTkEvh22hmjIeN qWR8QcpLZkCLzTAsbp4RAefUK3H4yR9MlIvhNKS+I88eR+xIa6Fzv7mJY MMoKbqMkpC0XuJDihtbFxQ4FGN3rfErlOUxGHwR24IW7OHJA+wYli4LG0 w==; X-IronPort-AV: E=Sophos;i="5.46,382,1511798400"; d="scan'208";a="69974846" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 20 Jan 2018 00:58:57 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 19 Jan 2018 08:54:08 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip02.wdc.com with ESMTP; 19 Jan 2018 08:58:58 -0800 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Mike Snitzer , Ming Lei , Bart Van Assche Subject: [PATCH 2/3] blk-mq: Avoid that blk_mq_delay_run_hw_queue() introduces unintended delays Date: Fri, 19 Jan 2018 08:58:55 -0800 Message-Id: <20180119165856.17677-3-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180119165856.17677-1-bart.vanassche@wdc.com> References: <20180119165856.17677-1-bart.vanassche@wdc.com> 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 Make sure that calling blk_mq_run_hw_queue() or blk_mq_kick_requeue_list() triggers a queue run without delay even if blk_mq_delay_run_hw_queue() has been called recently and if its delay has not yet expired. Signed-off-by: Bart Van Assche Reviewed-by: Mike Snitzer --- block/blk-mq.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 6859b5492509..01f271d40825 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -787,7 +787,7 @@ EXPORT_SYMBOL(blk_mq_add_to_requeue_list); void blk_mq_kick_requeue_list(struct request_queue *q) { - kblockd_schedule_delayed_work(&q->requeue_work, 0); + kblockd_mod_delayed_work_on(WORK_CPU_UNBOUND, &q->requeue_work, 0); } EXPORT_SYMBOL(blk_mq_kick_requeue_list); @@ -1403,9 +1403,8 @@ static void __blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async, put_cpu(); } - kblockd_schedule_delayed_work_on(blk_mq_hctx_next_cpu(hctx), - &hctx->run_work, - msecs_to_jiffies(msecs)); + kblockd_mod_delayed_work_on(blk_mq_hctx_next_cpu(hctx), &hctx->run_work, + msecs_to_jiffies(msecs)); } void blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, unsigned long msecs)