Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758376AbcJQS1x (ORCPT ); Mon, 17 Oct 2016 14:27:53 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:47738 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758185AbcJQS1s (ORCPT ); Mon, 17 Oct 2016 14:27:48 -0400 X-IronPort-AV: E=Sophos;i="5.31,358,1473091200"; d="scan'";a="25774213" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Adam.Manzanares@wdc.com; From: Adam Manzanares To: , , , , , , , , , , CC: , , , , , Adam Manzanares , Adam Manzananares Subject: [PATCH v6 1/3] block: Add iocontext priority to request Date: Mon, 17 Oct 2016 11:27:28 -0700 Message-ID: <1476728850-2309-2-git-send-email-adam.manzanares@hgst.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1476728850-2309-1-git-send-email-adam.manzanares@hgst.com> References: <1476728850-2309-1-git-send-email-adam.manzanares@hgst.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [199.255.44.173] X-ClientProxiedBy: CY1PR21CA0045.namprd21.prod.outlook.com (10.163.250.141) To SN1PR0401MB1728.namprd04.prod.outlook.com (10.162.131.18) X-MS-Office365-Filtering-Correlation-Id: 73ed6eae-e26e-4d27-5e41-08d3f6bb4a93 X-Microsoft-Exchange-Diagnostics: 1;SN1PR0401MB1728;2:hlT8amLo7O9svjR9RLQxcquX1wHwCsQtu9dwkVKwmllxzF7LBYA76XQiE1QKauMjKOsYUkGR0/iuLN62siz157uI4LV7KyLKEJn2hfzZyZhpakJw1W6Fy+BSzJMdcIis6TNCpar0Fj+qj92bVOBIrBp0ciQyGWd17KlVcC/9tuYULVh7lTeji5yW5m9kSr5YJxbG6veJ7GMpResyJaUuZA==;3:uCyd70jqSEE6zOKEWGhIeH43QBzPATeBlu/04qtnHbuLq9L7G18uT6gUWVK+nnXBRHKysdpc1pjd024yAXijZJX7I6//kJ6BQFd4AeWHjJfhz0wYYlr7JcJypdHJ4qSRstJo+wjxw0drx/OTK5LaSw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0401MB1728; X-Microsoft-Exchange-Diagnostics: 1;SN1PR0401MB1728;25:j4YyLKXVdWZzBrVnPhjL6qyamaUo0772wnkV0yec5QTPNxurBh4jB2vFf1FkgExJMlbBRZZu0ZjAX/dlHBP/Ua8h20MUsvVXx9/uVUa72f7df69buUGq5Qnj1mamzITGiyF/sQ3XqCSJf/XIrY8AZAu9MYRwknRDZd6pNgAZELeLNPepV+IKB1IquCDjXmuMlQxzBjpWUxZ4DTto3xqO2E3YLdEg3MkyZ0jO5ciVWPwofr3J42O4BwMGBlKIKV+xZQEvDLow3xkQvHVxwm4wwPerVcB/aV6XB2Tsso6Qt/K4ig2bD3jJPLfYYv0xzycKhZ12CxoBMFqj/VXiITpOJZAx02KOG+C0mkMYWVXueAMZ81CQ72hd8vlgUe8SJ66LW4QfHF0PzQucX7IUdxad+gqQwvEDTuiUJTMOuBXRl7U8Kf0r1+Zej+xWCMJtVDTBs7NgBeCtwR1jssQl/0ggN+Rus5UMcHk7Y5JBjPgODmKssxdAoyJ+ihKj/EkqHBUwaVpJpEorGoXrDsMsOFNROvN7bXmqZKmgKpFZfQDDgH4NqaVlzih6yWwX3MjGCWT5q02sEOmSOPzsyvSS354unku0tkfB9Vai39Opyb+zYtQOk9LYCOblWvSsfb1sVjNNuE9fyQ1iZjxJos3bJwwf6m7U4mF7sIak2Wmf31xd8Au5RocbUuK3naobz8KdzM2EAMXtBR+VeHPXSzoSh6V5vFua0clcHV77Ev18fQovHLw= X-Microsoft-Exchange-Diagnostics: 1;SN1PR0401MB1728;31:zSrQ+MXIUAI2bYIkx07ZmZoZptM3YI8+Ia8OeLooU7DNGKSyGNZc3f0RBqg1J+fnr8L0VuoWQbbvM3U/jpJ24AjXU6hSg2egrvCwyeejzP6uITepRqy7xnQKJb2CudkgeDNLhpHO5MFVOedw5IfJN9s9fsL8dpg5D7kjRYBmQ6WiH6nK5eUbgVvr1Ttj7QS0YvqjVTrkfna6VJWpZ5mq+XPE3Lb4YfRijOGhdDfi/PUcBTLl9lePbdwYw00djpSFkYatOLn25Uhl5YcmkgfH+w==;20:USsiV1OXD5bswf2SpsVSYSK8xXOd3JFG1JsVoQe7x6NUTA4zpn3eWWCRUK0n6s1vb26IGfq/hpPiFLWYRxP2+UvH7N2Hat0gAKzH/x/VPqh/m3kN9dQA3Z+o8vhbQr54Mcu0EL6NgtGTJtUn+kcj5HtKLeVvir1pUqSdTfNsdCkaAR7i0W2Pi0oSZs9TqF6t7CHKC2SfYS62x+UuINm9bHfWsIueE+I6aSIlMjcYsw5Q9zEtGgoce3l0TC+PS1auzO7dmQB3O7AUTi1PHtomwhH9A4d7C85XabJlsNNLCrslkfUeiCAilaOql81zZHJNNky9eCAi0hLOEIzscBVqxwaulBPcnlhZENuIMVTz4PW6XJXwxlBIM8Q5QRkbslNITG0N/Kwdi00gJOzgyb83y3Pj90Ckbq6ezjAR1jeJCJgTJ9/W51GbwjN3tA2p5J8ADf+GTQJwZsLcLkq9u0ALd1flfs0xQLsmUGD0+l/QBsNFCHasxb5+c51SlsHmsMMK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026);SRVR:SN1PR0401MB1728;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0401MB1728; X-Microsoft-Exchange-Diagnostics: 1;SN1PR0401MB1728;4:onhsn0C5gZtCl7TUCPyiEgchyzoTZm1ypL4nnlWXm2kquc1BWn4CzWN0dyxJjRV+OosxX+Ul7jAg+OnkRmTxheEOenl674YKqXv3W8/8u3HdS3t3fTa/BpEp3voKQcMM2bEKt1RBCCBc5UDvHfeub47LjUmS/5Ob7yuIeas6J7TLeYFQgBEgEyRLGG20VdbxVXCFSu8P9nGJUYLVuB7mIToeTGFzDhoqEEakI0SwMgkN+7gnnX9SvitSdRuZM0g4cihCto8h/kEr8YYlNM/7aclDZ+/pHC/U12S1YWBXzTC16ABtClMqPDc3KQ9tW7ylcpsfF1HJyIiG6a5VlnM4vsvBZAZnUbTphMCdjSRY1kQmigCkzdHj9l5IcRmtDG1MxyFgxRz/fVrmV0WatDQlAxU2r8gN3TbfdEzb9PS67cM= X-Forefront-PRVS: 0098BA6C6C X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(189002)(199003)(5001770100001)(575784001)(6116002)(77096005)(8676002)(97736004)(305945005)(6666003)(7846002)(7736002)(81156014)(7416002)(3846002)(81166006)(5003940100001)(19580405001)(66066001)(19580395003)(586003)(189998001)(4326007)(92566002)(36756003)(50986999)(42186005)(76176999)(105586002)(106356001)(5660300001)(50226002)(47776003)(229853001)(2906002)(68736007)(48376002)(2201001)(42882006)(2950100002)(33646002)(101416001)(50466002)(7099028)(921003)(2101003)(83996005)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR0401MB1728;H:penguito.sanjose.hgst.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR0401MB1728;23:Hv92JeDoTnSWcxSAML31rV/6cxG02B8pbQkEV+v?= =?us-ascii?Q?yimlbRMc+KaQKy50w09Qe7X80SxXMD57I/bzWQ0k6VGi80wW8Ao0fiY7ULiu?= =?us-ascii?Q?ogENEZ/Rfak3VYYZTbkNaOzfbTRrCn1xoBmMtUs00fq4MEhU9Qz0gP/Rewy2?= =?us-ascii?Q?Tud9gB9SSqvK7Vopz+cZ66U0zOo0WkbPyB3gi0g/Zow4jobC9BzUfJo6OTIF?= =?us-ascii?Q?hc7a8NqpYPRe4r2T0DPVvATun5CUP5wQi0nuCTPG0I+DLc9qilzFWmgKOYpy?= =?us-ascii?Q?7jIw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6+k53Cl0z8aHFz?= =?us-ascii?Q?56BZ4HfEtQUgxw53eKEfOgC+Msplr0AxI4NIYVUqvOlqbLFDk7eMWT1k4kA?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;SN1PR0401MB1728;6:wst3YqQhO03qqecM3RZv/RVcqOk2IGBL+Ho4kO9FBXtg2jUUmoFB5bM3pIDgh7vlyFdLpLjMioJH9K0x8qE47SXn5KunL3/PZohZE299Cp2Jhcx6grpDZkLtl/3k8fomjUad7Y0B6wLH1Ik82ExJ01LLm4LUz3wpxkAxIW7h/2jTbiLBRd8VQI4ooLgl3n55M0JuGXtZsLTIAvfYK9iknfb1QtOcsQVfFGn1DH6q0Shk871G3hgm9g4BNlieceNecGwYYvSki2az/ac3gdCa/COmewsqaOoRItdsW6JMzFNgZflBDfDrW/rR+A1gnj7KmhZqLJvUKiRqAJUThmbMbn0qEPRphPvLeM/3hhJRqCY=;5:QbYbe6DhISOwA61ktflUOLT1jT0gaKvRNPF8WcT5UsA+QqlU1/cuQIjW6kPjrunwwLEANv/lSjytC62PHorIsB466z3c0LXlUSW9Ilzv/v52H8W+MLoqIQ0xuUh48FViO7j42qdprTsH+5JUlt7vih7fePRHmZNtPauLzgPHrU4=;24:H4tm0D3REJzLcMSpJuxdLuMdYawWDqVjUz87fldUAo75lTBhiasw/v2xjreNrvBI0qEqBwRwaQjAKSYAP4nsxJba6Of9iIhjE6lmKYZe+uE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR0401MB1728;7:7aoWmpBY4jAgj2xBx9xNd5d3ea8rDCoBzxtj+rOiIEVtB/Uc9nfsucd3MBNdFm3pBTkRclvCRB6QNhd5sr2K0g/+MUC1CXRC9n5iPNAs7d2QtBUmOt4c3cFcICCOZWERC3XFVmp8qDtxD8GGxE5eTwP3mUtcO9Tulmxzm/S0sJmWIj3tox07CUwdg4+NsIjlqxOoQY5+inVRNQnEkhdsUSex+zRY2qwCr668IAKpWaCsI3JwIFoush1dN+dfdzgfKyyAGNMcnsjFSPDid5DHSiJKXInEkXGjym6d2zuon3W7KzeczhkoXSLqMyVEtwMnHVaa9wyECBHv3+JO4cSzOrtqbCVuEv1OLOMqVljuM4M=;20:XdVLNwWZc4rQ/MjTmGNKjHnV6GfSLitlRRYoJrv/e6au0O8McQGkY9ri7d/NEuERWivdIdxyoM/KdSTXFmZyY0ZCFEb/8ZrxsPHN89VUzUKR3GQ0zOHZfsvqLjjY0gnzsZjnDIIoB4glV8Alr9IIsjLyZ8I1KGVbDV/m5FJJnfJqvu0laVNS18Y22fmtkl1c80qdAWxdDO8ygp3+djZ1iua3WNKz0XQ+aTeMzB7B2V73zAKOfITfCB+HYEEaCxOP X-OriginatorOrg: hgst.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2016 18:27:44.8221 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0401MB1728 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2564 Lines: 72 Patch adds an association between iocontext ioprio and the ioprio of a request. This is done to enable request based drivers the ability to act on priority information stored in the request. An example being ATA devices that support command priorities. If the ATA driver discovers that the device supports command priorities and the request has valid priority information indicating the request is high priority, then a high priority command can be sent to the device. This should improve tail latencies for high priority IO on any device that queues requests internally and can make use of the priority information stored in the request. The ioprio of the request is set in blk_rq_set_prio which takes the request and the ioc as arguments. If the ioc is valid in blk_rq_set_prio then the iopriority of the request is set as the iopriority of the ioc. In init_request_from_bio a check is made to see if the ioprio of the bio is valid and if so then the request prio comes from the bio. Signed-off-by: Adam Manzananares --- block/blk-core.c | 4 +++- include/linux/blkdev.h | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index 14d7c07..361b1b9 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1153,6 +1153,7 @@ static struct request *__get_request(struct request_list *rl, int op, blk_rq_init(q, rq); blk_rq_set_rl(rq, rl); + blk_rq_set_prio(rq, ioc); req_set_op_attrs(rq, op, op_flags | REQ_ALLOCED); /* init elvpriv */ @@ -1656,7 +1657,8 @@ void init_request_from_bio(struct request *req, struct bio *bio) req->errors = 0; req->__sector = bio->bi_iter.bi_sector; - req->ioprio = bio_prio(bio); + if (ioprio_valid(bio_prio(bio))) + req->ioprio = bio_prio(bio); blk_rq_bio_prep(req->q, req, bio); } diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c47c358..9a0ceaa 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -934,6 +934,20 @@ static inline unsigned int blk_rq_count_bios(struct request *rq) } /* + * blk_rq_set_prio - associate a request with prio from ioc + * @rq: request of interest + * @ioc: target iocontext + * + * Assocate request prio with ioc prio so request based drivers + * can leverage priority information. + */ +static inline void blk_rq_set_prio(struct request *rq, struct io_context *ioc) +{ + if (ioc) + rq->ioprio = ioc->ioprio; +} + +/* * Request issue related functions. */ extern struct request *blk_peek_request(struct request_queue *q); -- 2.1.4