From patchwork Fri Feb 26 02:36:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Derrick X-Patchwork-Id: 8430511 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 07D849FC33 for ; Fri, 26 Feb 2016 02:37:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4966F202B8 for ; Fri, 26 Feb 2016 02:37:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 621972035E for ; Fri, 26 Feb 2016 02:37:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751124AbcBZChE (ORCPT ); Thu, 25 Feb 2016 21:37:04 -0500 Received: from mga14.intel.com ([192.55.52.115]:52309 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751377AbcBZChD (ORCPT ); Thu, 25 Feb 2016 21:37:03 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 25 Feb 2016 18:37:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,498,1449561600"; d="scan'208";a="921433603" Received: from eremita.lm.intel.com ([10.232.112.217]) by orsmga002.jf.intel.com with ESMTP; 25 Feb 2016 18:37:02 -0800 From: Jon Derrick To: axboe@fb.com Cc: Jon Derrick , linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, keith.busch@intel.com, hch@infradead.org, stephen.bates@microsemi.com Subject: [Patchv2 1/3] blk-mq: helper to reduce queue depth on all hardware contexts Date: Thu, 25 Feb 2016 19:36:36 -0700 Message-Id: <1456454198-26683-2-git-send-email-jonathan.derrick@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1456454198-26683-1-git-send-email-jonathan.derrick@intel.com> References: <1456454198-26683-1-git-send-email-jonathan.derrick@intel.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Creates helper that limits the tags on all request_queues attached to the tagset. This functionality is used to reassign queues in host memory to controller memory buffers with lower queue depths. Signed-off-by: Jon Derrick --- block/blk-mq.c | 20 ++++++++++++++++++++ include/linux/blk-mq.h | 1 + 2 files changed, 21 insertions(+) diff --git a/block/blk-mq.c b/block/blk-mq.c index 645eb9e..c8bbb62 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2345,6 +2345,26 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr) return ret; } +void blk_mq_update_nr_hw_requests(struct blk_mq_tag_set *set, + int nr_requests) +{ + struct request_queue *q; + + if (nr_requests < set->reserved_tags + 1 || + nr_requests == set->queue_depth) + return; + + list_for_each_entry(q, &set->tag_list, tag_set_list) + blk_mq_freeze_queue(q); + + list_for_each_entry(q, &set->tag_list, tag_set_list) + blk_mq_update_nr_requests(q, nr_requests); + + list_for_each_entry(q, &set->tag_list, tag_set_list) + blk_mq_unfreeze_queue(q); +} +EXPORT_SYMBOL_GPL(blk_mq_update_nr_hw_requests); + void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues) { struct request_queue *q; diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 15a73d4..2596be6 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -244,6 +244,7 @@ void blk_mq_freeze_queue(struct request_queue *q); void blk_mq_unfreeze_queue(struct request_queue *q); void blk_mq_freeze_queue_start(struct request_queue *q); +void blk_mq_update_nr_hw_requests(struct blk_mq_tag_set *set, int nr_requests); void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues); /*