From patchwork Tue Mar 14 14:57:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9623647 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 838CE60492 for ; Tue, 14 Mar 2017 14:58:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74ED628537 for ; Tue, 14 Mar 2017 14:58:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69A272857C; Tue, 14 Mar 2017 14:58:05 +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.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 014F128537 for ; Tue, 14 Mar 2017 14:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753088AbdCNO6E (ORCPT ); Tue, 14 Mar 2017 10:58:04 -0400 Received: from mail-io0-f176.google.com ([209.85.223.176]:34439 "EHLO mail-io0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751157AbdCNO6D (ORCPT ); Tue, 14 Mar 2017 10:58:03 -0400 Received: by mail-io0-f176.google.com with SMTP id b140so1017126iof.1 for ; Tue, 14 Mar 2017 07:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=sVWo5Pbxj8OxvSwzUWDidbs20oihUkHZ/M2vSVvhmMA=; b=X2pkJXxReBalTnrbnzq1nD65HOIiRjpU4xwzkQ98TDoPU5YyUBx1282Bl83iW++OEI RLQFppoQLDnYJghlbbHvbbjAV+sLXcniHFeqMAcSZEsMteodQmaiC6ot7WLPcim8LpWz 1L/ZH7KS5OfR/p2JE1Z9So6irACnQumfJtcgl7P5L58B2m87uZ9VO4dtY9zQE07fjzMo sKMXhw5CITf3uYC+uc4fbqJ07Qx1ZtpH/kHAeddIuioidlHpADhyu9Kpm4mwuOe8TSlm qE8b4mCc25cj8du9z6PXH15O5BK9QNedDgnYC6B5D74ag06rPxTQP1u1y5nhKNJKiSg1 iNkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=sVWo5Pbxj8OxvSwzUWDidbs20oihUkHZ/M2vSVvhmMA=; b=M0mt5hL2+iWuvxdzj4UEmS8ZaWyQUZbhxHzhTpJZLsBvZG1KVnfGJPsxLmJueGzTtm 9B8QGChlZ1Hi6Fp9h9PX/F++WWSe3PMckKQT961eNGQ+CYxb8wakqjZdvqkLG+EOg59K VZeJLPDAd4Sbuq/wyeEquhFSQGotM+YKHN2BHRAoUmMsSGXfw4biEzkUH0fUK4vBCWYW 6huWlZqoVcHejrvoiG6lnAhM/RaGWbDm0f/f5p9I/zYdsvXCGM9Y0HCLFLl5KXstCzCs 1VvJjm0z+5i8f1H6Yn8ZauXW5YGvRTjPbFAh8Goizg/XFmi8NeJ4G0g2sTrKQT1PS2JY 3gxg== X-Gm-Message-State: AFeK/H3xgBvolHeCfxNRw9j8uZMsZmIDUMvGZtHxoYcCqtA9taVYCcKBarrwOdhal92g1Q== X-Received: by 10.107.144.197 with SMTP id s188mr230643iod.146.1489503471678; Tue, 14 Mar 2017 07:57:51 -0700 (PDT) Received: from [192.168.1.154] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id k66sm57859itg.8.2017.03.14.07.57.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 07:57:51 -0700 (PDT) To: "linux-block@vger.kernel.org" From: Jens Axboe Subject: [PATCH] blk-mq-sched: don't run the queue async from blk_mq_try_issue_directly() Message-ID: <3ac4f49e-3bc0-7fc6-e93a-db9ec7ad21cf@kernel.dk> Date: Tue, 14 Mar 2017 08:57:50 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 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 If we have scheduling enabled, we jump directly to insert-and-run. That's fine, but we run the queue async and we don't pass in information on whether we can block from this context or not. Fixup both these cases. Signed-off-by: Jens Axboe Reviewed-by: Omar Sandoval diff --git a/block/blk-mq.c b/block/blk-mq.c index 159187a28d66..4196d6bee92d 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1434,7 +1434,8 @@ static blk_qc_t request_to_qc_t(struct blk_mq_hw_ctx *hctx, struct request *rq) return blk_tag_to_qc_t(rq->internal_tag, hctx->queue_num, true); } -static void blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie) +static void blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie, + bool can_block) { struct request_queue *q = rq->q; struct blk_mq_queue_data bd = { @@ -1475,7 +1476,7 @@ static void blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie) } insert: - blk_mq_sched_insert_request(rq, false, true, true, false); + blk_mq_sched_insert_request(rq, false, true, false, can_block); } /* @@ -1569,11 +1570,11 @@ static blk_qc_t blk_mq_make_request(struct request_queue *q, struct bio *bio) if (!(data.hctx->flags & BLK_MQ_F_BLOCKING)) { rcu_read_lock(); - blk_mq_try_issue_directly(old_rq, &cookie); + blk_mq_try_issue_directly(old_rq, &cookie, false); rcu_read_unlock(); } else { srcu_idx = srcu_read_lock(&data.hctx->queue_rq_srcu); - blk_mq_try_issue_directly(old_rq, &cookie); + blk_mq_try_issue_directly(old_rq, &cookie, true); srcu_read_unlock(&data.hctx->queue_rq_srcu, srcu_idx); } goto done;