From patchwork Fri Jan 5 21:56:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 10147125 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 0848760134 for ; Fri, 5 Jan 2018 21:56:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B55628856 for ; Fri, 5 Jan 2018 21:56:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F7EF28886; Fri, 5 Jan 2018 21:56:43 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 B879F28856 for ; Fri, 5 Jan 2018 21:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753182AbeAEV4m (ORCPT ); Fri, 5 Jan 2018 16:56:42 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:39413 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753080AbeAEV4l (ORCPT ); Fri, 5 Jan 2018 16:56:41 -0500 Received: by mail-io0-f193.google.com with SMTP id g70so7176517ioj.6 for ; Fri, 05 Jan 2018 13:56:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=J5H3ow9ax6Q26tGKEjIYwjhChYd4hbENa0Sp3vG2TJw=; b=G82K1EKqHaHCzfF3RfEBx13Bj0A7z+kBcailxM7ZblvpcZA3dAZ84wZnp47y37z59K cwnpQ/3Ddg1J1tDeu9KhpfYhFXnoz0Sdfxeo6xNx8BnMLQ+AleG6YnGdjvSgxCKcD6Vr FnsbH2ItEpvG9RU/IKHc56d01fMZPAT/jIq9qG9OshagBW6B+cv2I/wAihx4sOZVU/4Y AQvsg7HtbhKHUfHoHoBCTozQ0Nw7PTIzLS+6UzemzpWfDqN6mpEwgYumDWUV57YS/tVb QKTxmiOU6Cai69d/OnVnwqh/+BCvjM/vRdoAmrUwje1U2VzHFL999WAedDrgh3Nr/gxv slrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=J5H3ow9ax6Q26tGKEjIYwjhChYd4hbENa0Sp3vG2TJw=; b=EY957/sjCnRMCoSkiPgB/TmdLhmDfAIO0scDUsd+YLqKH6bIWBaIOegPp41Q0Vls/4 gTJ0dRGJdtRun3O+usWBrz1ogVr17cMmPDaah8ZEH49neY7G0Yn8sW7ssy+4I3LUAXzm kFoL4F3mzCuSartAk0h/CxIWwjE3aaeGThRSB1eAid/LummmiOnpgrgFqtwRH0GWll84 Y2+toMv55OyA4on8lh09xEo51k00cKbn516xqOa3chuXIErr5D1X7hMCwkc0aeuUf43q OJ6chirRv1tVwNLBGE+aepsjaqQiO/creIzhIqTJYQFMAAijYGRLlBc2a7ZoofECJOkx wT/A== X-Gm-Message-State: AKwxytdZJEmftOUwL39EOwp5aeFEmOZ+cIvzI9SELqJRF0VqROQiUwla 2kBlqBAU/v3haY8xhXu2tbazYI1gsCA= X-Google-Smtp-Source: ACJfBotxC4Lpsqp141ZPxnnXWwCLesjf82hW3ZDDAEuhWf7FFnK8XqaKTSPnKdSAvZjo3ZjYf5ZmbA== X-Received: by 10.107.63.69 with SMTP id m66mr4952823ioa.107.1515189400854; Fri, 05 Jan 2018 13:56:40 -0800 (PST) Received: from [192.168.1.154] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id o39sm4045251ioi.1.2018.01.05.13.56.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Jan 2018 13:56:39 -0800 (PST) To: "linux-block@vger.kernel.org" Cc: Omar Sandoval From: Jens Axboe Subject: [PATCH] mq-deadline: make it clear that __dd_dispatch_request() works on all hw queues Message-ID: <2c4afe1c-fb16-0d48-7c5c-2b063a16dbd1@kernel.dk> Date: Fri, 5 Jan 2018 14:56:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Thunderbird/57.0 MIME-Version: 1.0 Content-Language: en-US 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 Don't pass in the hardware queue to __dd_dispatch_request(), since it leads the reader to believe that we are returning a request for that specific hardware queue. That's not how mq-deadline works, the state for determining which request to serve next is shared across all hardware queues for a device. Signed-off-by: Jens Axboe Reviewed-by: Omar Sandoval Reviewed-by: Ming Lei diff --git a/block/mq-deadline.c b/block/mq-deadline.c index d56972e8ebda..c56f211c8440 100644 --- a/block/mq-deadline.c +++ b/block/mq-deadline.c @@ -267,9 +267,8 @@ deadline_next_request(struct deadline_data *dd, int data_dir) * deadline_dispatch_requests selects the best request according to * read/write expire, fifo_batch, etc */ -static struct request *__dd_dispatch_request(struct blk_mq_hw_ctx *hctx) +static struct request *__dd_dispatch_request(struct deadline_data *dd) { - struct deadline_data *dd = hctx->queue->elevator->elevator_data; struct request *rq, *next_rq; bool reads, writes; int data_dir; @@ -372,13 +371,19 @@ static struct request *__dd_dispatch_request(struct blk_mq_hw_ctx *hctx) return rq; } +/* + * One confusing aspect here is that we get called for a specific + * hardware queue, but we return a request that may not be for a + * different hardware queue. This is because mq-deadline has shared + * state for all hardware queues, in terms of sorting, FIFOs, etc. + */ static struct request *dd_dispatch_request(struct blk_mq_hw_ctx *hctx) { struct deadline_data *dd = hctx->queue->elevator->elevator_data; struct request *rq; spin_lock(&dd->lock); - rq = __dd_dispatch_request(hctx); + rq = __dd_dispatch_request(dd); spin_unlock(&dd->lock); return rq;