Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933350AbcLMOpd (ORCPT ); Tue, 13 Dec 2016 09:45:33 -0500 Received: from mail-bl2nam02on0082.outbound.protection.outlook.com ([104.47.38.82]:42076 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932358AbcLMOpb (ORCPT ); Tue, 13 Dec 2016 09:45:31 -0500 X-Greylist: delayed 959 seconds by postgrey-1.27 at vger.kernel.org; Tue, 13 Dec 2016 09:45:31 EST Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Bart.VanAssche@sandisk.com; Subject: Re: [PATCH 5/7] blk-mq-sched: add framework for MQ capable IO schedulers To: Jens Axboe , , , References: <1481228005-9245-1-git-send-email-axboe@fb.com> <1481228005-9245-6-git-send-email-axboe@fb.com> CC: , From: Bart Van Assche Message-ID: Date: Tue, 13 Dec 2016 15:29:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: <1481228005-9245-6-git-send-email-axboe@fb.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [178.117.55.239] X-ClientProxiedBy: DB6PR0601CA0011.eurprd06.prod.outlook.com (10.168.88.149) To BLUPR02MB1683.namprd02.prod.outlook.com (10.162.213.25) X-MS-Office365-Filtering-Correlation-Id: 5295c8c0-82c9-443f-2ff8-08d42364738e X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BLUPR02MB1683; X-Microsoft-Exchange-Diagnostics: 1;BLUPR02MB1683;3:Ltq4ykoKeHCHt8NSXl/5P6LQ/pZZB+jcM2Ui6L6uj55WwuZBUtqZYMrxi4JXXQ7ABNgZ6oOhsGoJ2towhBHWfKj9P9LvjmDo9T4ZaurdAoyx/LTbpAQQDfvcwXX8LLDCGmedhAF6USYElss5b5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SfopehTRbwYevrFauU1+GhqoKoZb8WWpArgXDuyUJTcECRFdZmMB3kaxYTvPmBORDrDQSWaB7GgjI3XCuRHUgnQEowfD0JbL90yq/UdhKthhwEfM6H54I2in06fnryuEw2q3AJSpev13sbAYDVYgkeJjoPkTZ4D14hjTNrusbBxIJElbsl6Qwbr48dkIZxydgf44d2KrnH8YiEHeJpABtZjdtFB2GSX/VUY9kJ+cX+uvrX5D5w4qLqMsPYPIkTmKa7wkMxrQbTuR3AGtgDWXEQY6tV/zUiuY7xymBKewl8xOUFyFuqxlfApSP3836D2xvpqppL+PGgmTrPaQbSgbiIcp3A7yXMmakvKCwElnKIBKdVAgvow1kIeSsRL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(6072148);SRVR:BLUPR02MB1683;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB1683; X-Microsoft-Exchange-Diagnostics: 1;BLUPR02MB1683;4:sh64T5knqH8Q30pnhmERWObcZ4X7BuCAE3qxeMob944IUtNeMj1hbpV9XADmqo5NqTEXsrrYiMrV7fNCYIqpvSTssQBWbhViG55vrOEme/PjKlLmpXgkIKVXXYlTjWnji4FHzj45oEkGkEe2Tj2RHPgFe7H5jfjAXwShGp+kNW0qySe4v25K5pKuFVuzDuHctxSbrhAPRDheOvmP11toVv3HeRSwt+/xs4O68rvMC8Om+Z5zRoFzb5yOPqhqP+dmCZzLBFu36EeM5O6/lTIYVlQoU1SqAfkv2a/do0JHCUI+7OmS0JK51M+xS1Kk+r/LBFIrCzUwbI+JGckOy+IQxqxIPZvjEKKmPBieTZmH75BSTgFJdbvN0IMNyG1qOFrQ3ovATUMLNGqmN5H71XGkLq+KdHkkqmxk4ocS/x8LAmFClmSP2xq56uHuLVnmQEyqOSRKkQllnIOaYi4SSoNNfi4hxdFlClu0Ruu8Nbzs7/5BMS0BEjdTzbjroLNhjhwWXkiPZpmGCprlmTkQAhrxvAOQ9/IUwoz74lz3qtiAQ3uJ8pPSkzHPSA/cnwYJkVgExlpGkT2q9j9W2g/piqUq1A== X-Forefront-PRVS: 01559F388D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39840400002)(39410400002)(39860400002)(39850400002)(199003)(189002)(377454003)(51444003)(24454002)(97736004)(92566002)(50466002)(4001350100001)(31696002)(83506001)(4326007)(230783001)(2950100002)(64126003)(5001770100001)(81156014)(86362001)(106356001)(2201001)(230700001)(53416004)(36756003)(23746002)(2906002)(33646002)(31686004)(81166006)(105586002)(42186005)(54356999)(305945005)(76176999)(8676002)(50986999)(65806001)(7736002)(6486002)(65826007)(47776003)(65956001)(3846002)(6116002)(101416001)(66066001)(38730400001)(69596002)(229853002)(6666003)(68736007)(5660300001)(189998001)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR02MB1683;H:exp-402881.sandisk.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;BLUPR02MB1683;23:DtFWYFf4W+xD7f+Retw6ObEyqmK7LgxCSELyI?= =?Windows-1252?Q?1BlsExgE1nVqfzDoW4WsUCeBFjiEbdyiFoKciuv43sNz7chzN20VG5B6?= =?Windows-1252?Q?FqORt4xl80WJjY+i6edt0Nb8twJZyBGReiAPH40cpZImJ0D5+NP1Qwd2?= =?Windows-1252?Q?/K9HN05NdbuieLFZQnfSRlSyvZRSpJ9DT5+zDay5y06gnx+GRm40k8wP?= =?Windows-1252?Q?Q0wDxhKTNDTT7AZs3R/L+5EXM2t3JUFmIvuHIH6i2DCY0BxwNh1MX8hg?= =?Windows-1252?Q?mxKlPsaoNUMiimyjAtUqtucn3WSbiUk1S5oRHTbaNE5V9da5Ufp2OXIL?= =?Windows-1252?Q?bFYnaGDAjD6PGNfej/5Pc8rcjNGv7ikL37PrHZRgS5MIzTbkHkITha8/?= =?Windows-1252?Q?Q5/KFfojxVxtUnKKvYrWKV/hGKXob5GjW2UvFywrFD4e++ZdBoMMXIL7?= =?Windows-1252?Q?Bhsn0R1CZzd4D//Z7HbTCnVlHCjk1059RGC0P0ba/METzmx0V5gWbJ0/?= =?Windows-1252?Q?pX2gLDAB3UaFpNHrLSPcTMkUiXfejjTVau1jigpT066381k4stPoKNrt?= =?Windows-1252?Q?wZH00WFSKVtJCGyUwXI9a/9TSSjk45O812uYOhheW8zuwxI7iFsrbgma?= =?Windows-1252?Q?FV2/jd9nVR9yh1TIxC59rV7KK/UgSljcLbXRIp3Mmq0U+dPcWpm7eS6G?= =?Windows-1252?Q?ksR5P9EDZ1xCCyK+SiCuyiG1jKr/vTNcLnPJHYnFmOX/W5YG0HPj6Txs?= =?Windows-1252?Q?UICMNhNI1vwiW982Aj6zap6cEpxthkPj9SgWATbIZU4EjuOnOHwd5oWu?= =?Windows-1252?Q?cn4lGGon1zBla85pXXD/lKVok15Ib3E5DT0AL3GdMSsggWgnj+F+jeYE?= =?Windows-1252?Q?PIN0LGnB/8teBa9oaGU3g3Q28eX6i8293RPQLlVu4AY8J4DBJlvk537p?= =?Windows-1252?Q?8RZIyg61/fOyZXT74Nwmor4mzjuzTUTMh/4pfJPYcOi2C/Q6xmROxZBA?= =?Windows-1252?Q?AlQt8Vi4V+UfPZu9R1AvE6TPhx0LKel/x1RwI7kW/DzN3EMd/o8RFFjU?= =?Windows-1252?Q?Kro+0v7CtWx8iD0CUk3rA13op3qPysadj6X24TxpApZtqzh6+h4lRMt3?= =?Windows-1252?Q?C3L7afI635zTBWo1LQ5ri4zcyHaGVRywsyQC63n/E8P/Dgdgk2jf2Uz2?= =?Windows-1252?Q?1lB5vaKFqJOYy7p7kZ3ZxuLW7FtWBMZFTGMbtrTPXH1MMXi+PQMOJqMP?= =?Windows-1252?Q?4P3GG2z16iQ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IaXur492YUYRyw==;24:rA70NkSKs9fMMJjNpmLDLMP/CIeDlt9V/tj3VFJVrPJlB0MPb0otYwEOpcDiZtUvr4SkhQxhNLajeCAZOkynQvH4WPqGwdRWrQ0RvtQypZs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BLUPR02MB1683;7:E5S4CB3qEe60T7Bjir/Sak4mJBEY0E0klgTA7FNyQSsXUg+XUY72o2LvCUFn/ycCI68rIHnGAn4hKOF+tnSjNNlM160ADAY8fJMHP3c2Y8k8hiPPmiAIuq+SBwXuT/x6XVJPorxjhMgPBUQicGwJQYgLN11G3z/FnH6gk0guA6moGhwF19sNAvyvV7+OSMvGoDMprftSTK9Z8YDaArLu08DFZ8Bla0tFodc6PAr/csDIrwlrxetlpcxJjTnOJ8PjIt9R/fYUQENhKVO2oPF73zVjfsLweQjvESZSrpavCd2dymMCLYPfUJyoPu1GpFxQUOSdo/B0iUWh5v4xB7puDc7X/6LuTAnmwTNtbmx69ipAUDE3iRmvptvsezFdqVrcV7tgaZrKS5BbPokNPfgzze9nIJIH6RlS/UK1k8fUu5+7HiqLY17LsUuayC7l8h35T4PjtZlct2Bq5Hds4i3YiA==;20:D5lNjFA9cOSO/2iGcjj7xnJ2Vv0ZHKzb4k5vQ97kuGK5VQJS5Sk3ZtyXN368xnLt0y2LW7y2jt7+FZncTBr5LGe2A9mDLbtN5cptk/v7BlHDrqwawSSCyGXFoGyNC6ID1Q5dwTIB5SLryF0klv9rPuFg39q42cJ661qvELkiPpLXVyDlMcb+l0NB8xXxFvRCguURis3QL2hxNQvs8w+qSpp82FpmPMsrTlVkN6uPBJSiwvwxZIaG5WOsGjcfPrEe X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2016 14:29:29.8654 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB1683 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1873 Lines: 59 On 12/08/2016 09:13 PM, Jens Axboe wrote: > +static inline void blk_mq_sched_put_request(struct request *rq) > +{ > + struct request_queue *q = rq->q; > + struct elevator_queue *e = q->elevator; > + > + if (e && e->type->mq_ops.put_request) > + e->type->mq_ops.put_request(rq); > + else > + blk_mq_free_request(rq); > +} blk_mq_free_request() always triggers a call of blk_queue_exit(). dd_put_request() only triggers a call of blk_queue_exit() if it is not a shadow request. Is that on purpose? > +static inline struct request * > +blk_mq_sched_get_request(struct request_queue *q, unsigned int op, > + struct blk_mq_alloc_data *data) > +{ > + struct elevator_queue *e = q->elevator; > + struct blk_mq_hw_ctx *hctx; > + struct blk_mq_ctx *ctx; > + struct request *rq; > + > + blk_queue_enter_live(q); > + ctx = blk_mq_get_ctx(q); > + hctx = blk_mq_map_queue(q, ctx->cpu); > + > + blk_mq_set_alloc_data(data, q, 0, ctx, hctx); > + > + if (e && e->type->mq_ops.get_request) > + rq = e->type->mq_ops.get_request(q, op, data); > + else > + rq = __blk_mq_alloc_request(data, op); > + > + if (rq) > + data->hctx->queued++; > + > + return rq; > + > +} Some but not all callers of blk_mq_sched_get_request() call blk_queue_exit() if this function returns NULL. Please consider to move the blk_queue_exit() call from the blk_mq_alloc_request() error path into this function. I think that will make it a lot easier to verify whether or not the blk_queue_enter() / blk_queue_exit() calls are balanced properly. Additionally, since blk_queue_enter() / blk_queue_exit() calls by blk_mq_sched_get_request() and blk_mq_sched_put_request() must be balanced and since the latter function only calls blk_queue_exit() for non-shadow requests, shouldn't blk_mq_sched_get_request() call blk_queue_enter_live() only if __blk_mq_alloc_request() is called? Thanks, Bart.