Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933171AbcLMN5M (ORCPT ); Tue, 13 Dec 2016 08:57:12 -0500 Received: from mail-sn1nam01on0046.outbound.protection.outlook.com ([104.47.32.46]:7680 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933061AbcLMN5K (ORCPT ); Tue, 13 Dec 2016 08:57:10 -0500 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: <69c1261a-1a21-7347-c753-0bcb9a2ab65e@sandisk.com> Date: Tue, 13 Dec 2016 14:56:56 +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: AM4PR0201CA0029.eurprd02.prod.outlook.com (10.167.253.167) To BY2PR02MB1687.namprd02.prod.outlook.com (10.163.27.25) X-MS-Office365-Filtering-Correlation-Id: dcae4e85-8617-4b6e-4024-08d4235fecfb X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BY2PR02MB1687; X-Microsoft-Exchange-Diagnostics: 1;BY2PR02MB1687;3:/ewa0NJLyPeoE/O72nmb3zjYaV5mQv62mg0wMtXFBKoIt2Kwvpuzjv+R4H0bgOxgRbv4MLne9q1uAEF3Zyum4PvmUGBzImDHz1mNlMpGi5g2e0Ncf57lwCTvE3Sb6GyZuesw2TlDEFHtEQLmtfpoVYnyl2Wh1V2hl9LvKB4Z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Ds9SMjvMgpimx6Lfs86hVINbX+Dm1l6j+KeFfO1rzXpmuy30dPOKoOQhOvfCfO4BmJBzwZhsHQHwpoJjlaDnNl3LkOrNXh3dPfSnJ9+pTC+7og/GLtHSG51PM7EUjUbiwc1WeEo4LMbBPONLM1b4uAmEgc5P5ZNBDVoYXEMA==;20:H72TPXWFgZUYLOSfsT28Tu7XFEIwsbfGG2LejoZ3iSmNtZVhA6rIYSvIDjZlHc8HUFWKlidbnltez1mtfhBptA2aTMf4BwiQmjx9XX0tm8nz218A4FmcdTFoGfGU/aXcTOIEWlCqii5kOR375RnrK5FKdCX0nQELxPGPRE3wQG7zmrZyI0584tXHeZXk3pED6GkPHbOoYHFeFteuNUvqFcGBu3XK+Vh4dSkjAHjJf6nNjkwqIO+VimIUbmQPi+bV0iXKrrvAY7DyaYALkMYPuOug6rSAvx4gmxfrdJO4yZlXZTqkZ1HSaLIBg+LOEHWpogcrboNzNVIrctP6nf04NRM87eeG6QXSX0tFpkIx0BDaMAAlK8pH+vWAe6GMn1VEzbv/yDAw6esPEJ/Hs+cPeoagNu5OBV6AZrcArJk60IRTRahdFN59CYOW7r4UKm/ROg4Ki7UymqOpP/h60Szf4cpXmN3rbk/7yhJ8942tK18xYHFKIC6cx2YcGs6V0z+U 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)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(6072148);SRVR:BY2PR02MB1687;BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB1687; X-Microsoft-Exchange-Diagnostics: 1;BY2PR02MB1687;4:xabdhTocYmMWBGaijR1PTzJb3se7BryfFZK2YMaVtdrFsDx3lVeAlIVwJ6RyFGjNEMg7ae9hdDKtjZORUu32mVjr1GVCmHN7JcxsYvsyy4/vLebZ0BGGq01LsTsc0NdjFDboBE+RC2+Vc/keK9kQ3XrDLjOc88S7ehPPT+Ow4Skoj7GENJPlb+xYT/7LCNwGFASagOWUpsuaOQeClBdIAdVg6cvfBavLO173RID1D1W40UvNBSwdxs2pOKqPZRRhAgihALDC/2dojNxFGEGFmlER7pVu92XFAx3qFJJDUXlc1Vi7TxQI0MVkqNNJB1NE1TcNtEYKHtMNwYRbC5y1j45OL0BPqmJnvvMSOm1eZLyxteHhEU22ZR44Ss8R0oSx0CC0N0+SoOjfa+qrt1LHdjUnFLhSZO5sBtpfKa3UzzM7npyjA4mjVadCJTafRiWIhLH1Fiwf7N3kk/YyBxqfXkDiGQjlw3LY6ZoxAX72b1bRPtluk5CjoauUp11npb7hmRzXVBgIgiQe+9ANyMxLVZDnI2OXQEKBDv5SCXoCj1zbqshnao1AiAhqaEvkVDqLznOfLww8RCY2/DV3tc9Jpg== X-Forefront-PRVS: 01559F388D X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(39850400002)(39840400002)(39860400002)(39410400002)(39450400003)(24454002)(199003)(377454003)(189002)(86362001)(31696002)(229853002)(68736007)(189998001)(2201001)(65826007)(33646002)(38730400001)(6486002)(5660300001)(83506001)(2950100002)(6666003)(42186005)(54356999)(65956001)(66066001)(65806001)(31686004)(4001350100001)(76176999)(53416004)(50986999)(230783001)(106356001)(105586002)(69596002)(5001770100001)(47776003)(101416001)(97736004)(64126003)(2906002)(6116002)(36756003)(50466002)(23746002)(4326007)(8676002)(81166006)(3846002)(305945005)(92566002)(7736002)(81156014)(230700001)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR02MB1687;H:exp-402881.sandisk.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;BY2PR02MB1687;23:XPfDkkBGpT1EeBRaPad27Uta6bQpJBs+G5kNt?= =?Windows-1252?Q?khG7QXYNrOiXkn5hDTUuj05Qkgq3km1PYAVgkj+G7m6DjMoLvTwmAiLT?= =?Windows-1252?Q?MvIw7Mw086A3uB/DxdOdLiBRa3J8SvzLUh2P8emmKqwxzJuuZxDjgpSp?= =?Windows-1252?Q?mf4wUP9qdqas+bFDzAnk9pSm2uttvkLWo6CSq3DrRPJYwMcPs+EjwLWP?= =?Windows-1252?Q?CfMeX3X4kjcpKv4eRtzaYQc6B8j7OsME8begihxl3wdEZbxDT8j2BpNQ?= =?Windows-1252?Q?m4zKsyDYNKKHa4dZfgk7WNngZuYLaaQnsW10yef0FBKEYxtyV+rHC/ST?= =?Windows-1252?Q?rOwKs7W5gP3SeeKj2SplNRUvXeDYOdosh7b5L9N4IidtCYax9CxWVdVi?= =?Windows-1252?Q?G7iueg2SAjOLLPbN/ItGpbnfWctWg/pdkjQjAesVDZEXjelLWVktUTFB?= =?Windows-1252?Q?vT19l9p6cX1j2PNLv1B+dDbSH6zme72O7vR7wmySALj3xen1hGGuVgbL?= =?Windows-1252?Q?J2bw197FQv+mjvAJhyonYi6/w+DTZSqRyf8mXVEVTyf+2OE7CKGSqb77?= =?Windows-1252?Q?05Y6FF47w4IfH89S0svJHQNM1gmVwVqeSeUdbKSIJrZPyr9Ato+y81H6?= =?Windows-1252?Q?RykOVFqrjITwIIcbiOHhG7pBCbQXAES5VSfTRnxWHoq1b1K8RcnwX6JJ?= =?Windows-1252?Q?800LlJT3MLGMX6F9uudve58lnzh/t77kXVcPVG/ZA2ffGRGp/d+sXKp1?= =?Windows-1252?Q?ZHDmu9E7AIjkx8AjxnOK2mS/E7VDB6X3xbMicXnm2Ywd+7zopBqTxiJA?= =?Windows-1252?Q?CSyAioz4EAwFi/YdfSDOcYzoTmgqMyGGuVhR069/oy9EfncPdcFiQlyz?= =?Windows-1252?Q?SCEVjanQVKrHhzsZOuIh+1Nt71Rz/e/6x40cXcB2bpY/XwUcnJD4EKve?= =?Windows-1252?Q?95R/43CIGIrqz6lo2L2MYz57UDB+oBHLkr2FgdUF1ihfxTkNZUx7nUSq?= =?Windows-1252?Q?z1Hx7amxj5ZKKQewhTgLKtlPQe5jKOyTSb/bh2aa6zGvZdp0PUZIozxZ?= =?Windows-1252?Q?J0u9mpXGrREX8+dHUojYVI+j0oKkWlMPMoAJZLocVZy3XtWqKbsUglUf?= =?Windows-1252?Q?f8Yu4PFH+/bAwMxWAc7rDw+JPO6w5MhNMCDa5iaavh0bGjr66yem01b8?= =?Windows-1252?Q?uBui6EVeCJKM71jYXZEHkYWdMGFXtKFx1/fklfg7xNfu17WCQz4JQNxW?= =?Windows-1252?Q?PEWqVHktqWW0J1gyMO8gfCoTnKTsWIdMjnQEa8LZsJI/OpRD6wK5eQY8?= =?Windows-1252?Q?N9PiDNgV39aU06Ka9yim+ZQjJMvIt9Ok/KbVg8oqoRsi0fykmGJkj4bT?= =?Windows-1252?Q?3wJi+b4DfwmNa14hCct70fP+bbjzrXn/CoDH6JGPoAIuh9cryhR5dRZy?= =?Windows-1252?Q?phc6CWpcz6F+g08oIvcI0B5fgtZDFM4Sc9xYP0Lwq4Q5xnUd8H+pTdc9?= =?Windows-1252?Q?sWjLp17e4P/lwLSI33NsZhdNBRLPY7QO7desATrzYDBktgwj/3PDLJ6+?= =?Windows-1252?Q?6//knWPG8sAG6wOj/qZMLaEGnzrORtvbMJv?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR02MB1687;6:l9j/vfucJ7IpwfNSUKN+2XAZDY+lbEtP0quWu0i5Ick8xircLQSynOZvcm6R5JiyjfLlzqEtHuwGq9ok6gXNFfIjWsKk8hLqcjeh3cRS6XHaVLAXvUR5vZu8yOWNPSXhINbZqvR8qI4JHmlDwMu8NkM06QfN6fkxtuM1+qivnNcJ2/3X2MQqGt9/20fhkx0yeYTI9S2lbDywXDsfLrLjokGzP09ADD835G+6CO8Y5fRN1knQSjeBJ2p7zXMl3LFtOKi9P1ywmDkLZszll7EBJM+gPehwul/h5Xc0dN+4Di6Vrw9D2MTMvhCsH61LYddSz+UHAVvG+vHBPaaRz/XPJn3J+Yt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VjUq1T37WQA8xmCWZWcZ58ox5AoVWxhWEYfQ5RxgciKgn2/srvS4DCuYL7+EtaahLqSqJQQGo+ewVrZNPrPuqCWzQoRMDoweEFb1ox+TsrrU7DKt4k4W1I9HtoW9fo X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2016 13:57:05.8086 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR02MB1687 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2382 Lines: 69 On 12/08/2016 09:13 PM, Jens Axboe wrote: > +/* > + * Empty set > + */ > +static struct blk_mq_ops mq_sched_tag_ops = { > + .queue_rq = NULL, > +}; Hello Jens, Would "static struct blk_mq_ops mq_sched_tag_ops;" have been sufficient? Can this data structure be declared 'const' if the blk_mq_ops pointers in struct blk_mq_tag_set and struct request_queue are also declared const? > +struct request *blk_mq_sched_alloc_shadow_request(struct request_queue *q, > + struct blk_mq_alloc_data *data, > + struct blk_mq_tags *tags, > + atomic_t *wait_index) > +{ Using the word "shadow" in the function name suggests to me that there is a shadow request for every request and a request for every shadow request. However, my understanding from the code is that there can be requests without shadow requests (for e.g. a flush) and shadow requests without requests. Shouldn't the name of this function reflect that, e.g. by using "sched" or "elv" in the function name instead of "shadow"? > +struct request * > +blk_mq_sched_request_from_shadow(struct blk_mq_hw_ctx *hctx, > + struct request *(*get_sched_rq)(struct blk_mq_hw_ctx *)) This function dequeues a request from the I/O scheduler queue, allocates a request, copies the relevant request structure members into that request and makes the request refer to the shadow request. Isn't the request dispatching more important than associating the request with the shadow request? If so, how about making the function name reflect that? > +{ > + struct blk_mq_alloc_data data; > + struct request *sched_rq, *rq; > + > + data.q = hctx->queue; > + data.flags = BLK_MQ_REQ_NOWAIT; > + data.ctx = blk_mq_get_ctx(hctx->queue); > + data.hctx = hctx; > + > + rq = __blk_mq_alloc_request(&data, 0); > + blk_mq_put_ctx(data.ctx); > + > + if (!rq) { > + blk_mq_stop_hw_queue(hctx); > + return NULL; > + } > + > + sched_rq = get_sched_rq(hctx); > + > + if (!sched_rq) { > + blk_queue_enter_live(hctx->queue); > + __blk_mq_free_request(hctx, data.ctx, rq); > + return NULL; > + } The mq deadline scheduler calls this function with get_sched_rq == __dd_dispatch_request. If __blk_mq_alloc_request() fails, shouldn't the request that was removed from the scheduler queue be pushed back onto that queue? Additionally, are you sure it's necessary to call blk_queue_enter_live() from the error path? Bart.