From patchwork Fri Apr 28 14:31:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9704901 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 DBF7F60225 for ; Fri, 28 Apr 2017 14:33:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE7D926E49 for ; Fri, 28 Apr 2017 14:33:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C319B2865A; Fri, 28 Apr 2017 14:33:03 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI 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 6BBEA26E49 for ; Fri, 28 Apr 2017 14:33:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938930AbdD1OdA (ORCPT ); Fri, 28 Apr 2017 10:33:00 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:39434 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032630AbdD1OcG (ORCPT ); Fri, 28 Apr 2017 10:32:06 -0400 Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v3SENfO5024458; Fri, 28 Apr 2017 07:31:57 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=fyptS6G+XW1HYaz8REPmzjPifninBSZEr1qweh5d/10=; b=aRBPguGcCTPBFn5SZ/Tw9cQRpb0ET/8NurRjjbRf8Sv1pVe76IdqbPisJ9z+vdcQxJva NbLIRNpfeL0GIQrt7G5B5YObvJiZ4LHXQH4DcCBH7ilqEiV/QUrpgHxnN/cpDmFPtsUj bn2SxER+N77EqJyDUtXmyCFdYp1DRUHnN+o= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2a41wurud6-2 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 28 Apr 2017 07:31:57 -0700 Received: from localhost.localdomain (192.168.54.13) by mail.thefacebook.com (192.168.16.16) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 28 Apr 2017 07:31:56 -0700 From: Jens Axboe To: CC: , , Jens Axboe Subject: [PATCH 4/6] blk-mq: don't bypass scheduler for reserved requests Date: Fri, 28 Apr 2017 08:31:49 -0600 Message-ID: <1493389911-19512-5-git-send-email-axboe@fb.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493389911-19512-1-git-send-email-axboe@fb.com> References: <1493389911-19512-1-git-send-email-axboe@fb.com> MIME-Version: 1.0 X-Originating-IP: [192.168.54.13] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-04-28_07:, , signatures=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 Instead of bypassing the scheduler for insertion of reserved requests, we ensure that the request is marked as RQF_RESERVED so they driver knows where it came from. Usually we just use the tag to know if it's reserved or not, but that only works when the request has a driver tag assigned. Using RQF_RESERVED can be done independently of whether or not scheduling is used. Signed-off-by: Jens Axboe --- block/blk-mq-sched.c | 8 +++----- block/blk-mq.c | 3 +++ include/linux/blkdev.h | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 8b361e192e8a..27c67465f856 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -82,11 +82,7 @@ struct request *blk_mq_sched_get_request(struct request_queue *q, if (likely(!data->hctx)) data->hctx = blk_mq_map_queue(q, data->ctx->cpu); - /* - * For a reserved tag, allocate a normal request since we might - * have driver dependencies on the value of the internal tag. - */ - if (e && !(data->flags & BLK_MQ_REQ_RESERVED)) { + if (e) { data->flags |= BLK_MQ_REQ_INTERNAL; /* @@ -104,6 +100,8 @@ struct request *blk_mq_sched_get_request(struct request_queue *q, } if (rq) { + if (data->flags & BLK_MQ_REQ_RESERVED) + rq->rq_flags |= RQF_RESERVED; if (!op_is_flush(op)) { rq->elv.icq = NULL; if (e && e->type->icq_cache) diff --git a/block/blk-mq.c b/block/blk-mq.c index b75ef2392db7..0168b27469cb 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -268,6 +268,9 @@ struct request *__blk_mq_alloc_request(struct blk_mq_alloc_data *data, data->hctx->tags->rqs[rq->tag] = rq; } + if (data->flags & BLK_MQ_REQ_RESERVED) + rq->rq_flags |= RQF_RESERVED; + blk_mq_rq_ctx_init(data->q, data->ctx, rq, op); return rq; } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index ba3884f26288..c246de5861dc 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -120,6 +120,8 @@ typedef __u32 __bitwise req_flags_t; /* Look at ->special_vec for the actual data payload instead of the bio chain. */ #define RQF_SPECIAL_PAYLOAD ((__force req_flags_t)(1 << 18)) +/* Request came from the reserved tags/pool */ +#define RQF_RESERVED ((__force req_flags_t)(1 << 19)) /* flags that prevent us from merging requests: */ #define RQF_NOMERGE_FLAGS \