Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2539410imm; Thu, 16 Aug 2018 11:07:40 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz9dHc/V0Vl/YLhzlBNpJT7v60/ayFrJKmX+Kiiq3GfmIqg3X4KQD8B8iss0k+ORpXmpTmG X-Received: by 2002:a62:ed5:: with SMTP id 82-v6mr33125908pfo.198.1534442860422; Thu, 16 Aug 2018 11:07:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534442860; cv=none; d=google.com; s=arc-20160816; b=CnVuRpklmuQR/LYA7PIPqOCrpZuUr6IlT4O8gl8MF5jFHF1clDmLBphYMIfbkkXzw/ ksQD/S/Sa2T+wI8tGpPvG06f9RME49/fmFq0THYgu7B/O03mmIr2i8839c6ckY8eNlXg sHPhkxK+YrB0RjVsUrXIk847ZQHsPGFSwjahsUN8ZjwNL4341Xr1VmjIsvLDMfzioQp9 dF5xj+y7cCsGzMiw+ikUCNWnRf3L0QtofyXmSjeCxFS4w+60c9//o3c/AjsPbx+sk+Q4 SbSSNlNIoN/LOq/EeK8GSa6o/SIY13eYIBlV72bs1euMhCqvAO3erE71aDjsKqF7pGUw i2aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=lykrwNT7YoBl13p+klhUl2RXutNwLkSAZ98jXgkOY2k=; b=DOWnTzbyAjHSDXlVm18GHteOVAuVCQ4EphviZhiCy91h4s79lEArfwuteOYlmc09dq YGKMgVY7gwdEb3UZtQrofnDipKfn9y9pZ/yI5YYepFjnFOlZUU/dWHfppNI4Jd3ZgRqK A33Luj2ZR23Zl00bmCfNmKQMcAfZ5ZGifhH+siCQ++iLFXWv2Ja1p56L3BnkASmwTvlB o4x4NDJlAUOgMtdAkh1788sJCd4vstxOPSbUDWTMIFQRZPExtQ9kN2Q5Al+TrTYHWUwh vQK3/O9NxV6ZuQlM3ebqbOiNHr5gUqr/TLwBfH43PZqmv3Gux1ORo9ILTsxukWQA8bXR BzJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=W0pe5d6c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7-v6si26512938pgf.231.2018.08.16.11.07.25; Thu, 16 Aug 2018 11:07:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=W0pe5d6c; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390661AbeHPMu0 (ORCPT + 99 others); Thu, 16 Aug 2018 08:50:26 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:46840 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727206AbeHPMu0 (ORCPT ); Thu, 16 Aug 2018 08:50:26 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w7G9iHrI051730; Thu, 16 Aug 2018 09:51:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=lykrwNT7YoBl13p+klhUl2RXutNwLkSAZ98jXgkOY2k=; b=W0pe5d6ckBuFCQQH13ClLknGJ2Z97AiOUJaT1J/FublLgjIt1lTiJKKQw/yS777TNIBR 0L/xOQ72M5y49Hj2/aQIwO99vzkFyd05wUgLTsnmW4+2w9XiWB0LECf23SAvTPigXErC sE0p44mQQEeVIYiEQEcMdWtShafP0VgOggBqNNsrI/GmUCgmuE2nuq/VgQvNDTvNIE2M /c+ZiSVFDwnPfhtsKY7oT2xxKMYNpKGh/vswBKInhEDTnXixxCtbvsgbrxQvfqNN4K+4 BGPx5tFP2aAj7685+MdETrTTLbf3V319pi2sr2qY1NjMktDMgNaXd8oF6AcN84hDb749 cw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2ksq7thhu0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Aug 2018 09:51:58 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w7G9pv79011922 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Aug 2018 09:51:57 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w7G9pvYs007862; Thu, 16 Aug 2018 09:51:57 GMT Received: from [10.182.69.179] (/10.182.69.179) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 16 Aug 2018 09:51:57 +0000 Subject: Re: [PATCH 1/2] blk-mq: init hctx sched after update cpu & nr_hw_queues mapping To: Ming Lei Cc: Jens Axboe , Bart Van Assche , Keith Busch , linux-block , Linux Kernel Mailing List References: <1534317915-5041-1-git-send-email-jianchao.w.wang@oracle.com> <1534317915-5041-2-git-send-email-jianchao.w.wang@oracle.com> From: "jianchao.wang" Message-ID: <3c8077f8-9793-3992-29f4-0cdbc7aafffc@oracle.com> Date: Thu, 16 Aug 2018 17:52:06 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8986 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808160103 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/15/2018 07:32 PM, Ming Lei wrote: > On Wed, Aug 15, 2018 at 3:25 PM, Jianchao Wang > wrote: >> Kyber depends on the mapping between cpu and nr_hw_queues. When >> update nr_hw_queues, elevator_type->ops.mq.init_hctx will be >> invoked before the mapping is adapted correctly, this would cause >> terrible result. A simply way to fix this is switch the io scheduler >> to none before update the nr_hw_queues, and then get it back after >> update nr_hw_queues. To achieve this, we add a new member elv_type >> in request_queue to save the original elevator and adapt and export >> elevator_switch_mq. >> >> Signed-off-by: Jianchao Wang >> --- >> block/blk-mq.c | 37 +++++++++++++++++++++++++++++-------- >> block/blk.h | 2 ++ >> block/elevator.c | 20 ++++++++++++-------- >> include/linux/blkdev.h | 3 +++ >> 4 files changed, 46 insertions(+), 16 deletions(-) >> >> diff --git a/block/blk-mq.c b/block/blk-mq.c >> index 5efd789..89904cc 100644 >> --- a/block/blk-mq.c >> +++ b/block/blk-mq.c >> @@ -112,6 +112,7 @@ void blk_mq_in_flight(struct request_queue *q, struct hd_struct *part, >> struct mq_inflight mi = { .part = part, .inflight = inflight, }; >> >> inflight[0] = inflight[1] = 0; >> + > > Not necessary to do that. Yes, I will discard this. > >> blk_mq_queue_tag_busy_iter(q, blk_mq_check_inflight, &mi); >> } >> >> @@ -2147,8 +2148,6 @@ static void blk_mq_exit_hctx(struct request_queue *q, >> if (set->ops->exit_request) >> set->ops->exit_request(set, hctx->fq->flush_rq, hctx_idx); >> >> - blk_mq_sched_exit_hctx(q, hctx, hctx_idx); >> - >> if (set->ops->exit_hctx) >> set->ops->exit_hctx(hctx, hctx_idx); >> >> @@ -2216,12 +2215,9 @@ static int blk_mq_init_hctx(struct request_queue *q, >> set->ops->init_hctx(hctx, set->driver_data, hctx_idx)) >> goto free_bitmap; >> >> - if (blk_mq_sched_init_hctx(q, hctx, hctx_idx)) >> - goto exit_hctx; >> - >> hctx->fq = blk_alloc_flush_queue(q, hctx->numa_node, set->cmd_size); >> if (!hctx->fq) >> - goto sched_exit_hctx; >> + goto exit_hctx; >> >> if (blk_mq_init_request(set, hctx->fq->flush_rq, hctx_idx, node)) >> goto free_fq; >> @@ -2235,8 +2231,6 @@ static int blk_mq_init_hctx(struct request_queue *q, >> >> free_fq: >> kfree(hctx->fq); >> - sched_exit_hctx: >> - blk_mq_sched_exit_hctx(q, hctx, hctx_idx); > > Seems both blk_mq_sched_init_hctx() and blk_mq_sched_exit_hctx() may be > removed now. Yes, I will remove them in V2. Thanks Jianchao