Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932792AbcJNSgg (ORCPT ); Fri, 14 Oct 2016 14:36:36 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:47077 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752560AbcJNSgH (ORCPT ); Fri, 14 Oct 2016 14:36:07 -0400 X-IronPort-AV: E=Sophos;i="5.31,346,1473091200"; d="scan'";a="25311828" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Adam.Manzanares@wdc.com; Date: Fri, 14 Oct 2016 11:35:54 -0700 From: Adam Manzananares To: Hannes Reinecke CC: Adam Manzanares , , , , , , , , , , , , , , , Subject: Re: [PATCH v4 1/4] block: Add iocontext priority to request Message-ID: <20161014183554.GB6788@hgst.com> References: <1476388433-2539-1-git-send-email-adam.manzanares@hgst.com> <1476388433-2539-2-git-send-email-adam.manzanares@hgst.com> <733629ac-fb98-9acf-3b2b-e1554e839346@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <733629ac-fb98-9acf-3b2b-e1554e839346@suse.de> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [199.255.44.173] X-ClientProxiedBy: BY1PR0201CA0009.namprd02.prod.outlook.com (10.160.191.147) To BLUPR0401MB1715.namprd04.prod.outlook.com (10.162.215.17) X-MS-Office365-Filtering-Correlation-Id: c82b5d87-c015-46fe-f877-08d3f460f3e9 X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1715;2:LtULs2PV9khBzY7LNz9AYseXdvgY75uN3cgHnRtdOLbyQckiqT42rMqEE7x1S8Bur1ecGoSFnQMkiKjEMFgZwGzCe/vA+joj4/JGlWPEazNCXYI0VUxyjSc7FXD3vNL7T1TJ/V8VPKjHvwI4slos/fnZqT2bE+LnmJ3PkayJUZ4DrkaXF5cH2/JSZr9DZkcVZNVER7e0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Z5f+q56sf8XpASDkFGT2+EanYsfvX2y7Ez7bGlydOOWWkerMXZh8euL3/hJHH7gt+Gfx9zo+RUtywhBjPIy3C4n08dGMMTYGf6iyOdIOnQNqpMeoDm1d5xMeovvmTkcnL+U7LUT+lrhRsG13OaPu4rD/6IfIuamZmLlQYKfjkYdWNotRq/dRwSHA5vv8CyhIsHfOt/CB8PzZD/bNipuRelOK3KHtISCfc8KJIlIrUY6jMeaZF5HIZOuRCF/FWAkNRw==;20:YKK1IO1Vy9DYbD8dfty5RFCWEd1ZpL6kW7JBk830vxoBrisYb6EtWxwDVYF5Pz9Q1RjWh7PfJRlBt9Z2k5swwowJJSOrzadqEmVFqPQToF1qVcaqGaGTT+Obovnu1n+rlH+SluhDyZXdF72KvtGObAahtp6iOfvSOESm0ube8PrNX5PLOqIkVgNaOrZ6t2x7jcZF60k7p4GNnb947xm3tm9ib2aszkWgW19TuIDyTIe6anqIhw38xGFi+IM3fIQyZi1xf9FOXu9QJXLIsaUbpLz/afdMP0KkRs+t1z78VoGvuc16UbBihHBjtPABtrkPHzf68yp+S0C84R8geDRHj1MFa11ii9FxbYYJfSrQsh8WgVPic4cKPH4g+x42pRe6fGujELRLoS+EUZAmp6KT57S1LaEHkq2y+hu0+fYDtZpYzfqcMARMk9CwXUS1f+1xBYYliapsfxIAahvxIl0UFdqgpiwNlObXcgH5QCWH1ofvOhqAKNDFvi5tTRAA8ds+ 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:BLUPR0401MB1715;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0401MB1715; X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1715;4:1zLTHFflt+tTgHzTmO9kU7NsgZAgUM6muQIl+gRym02Moq69vshQjtruSo7KcOy/q4YmSOciH19XT+f8dl3/QtPRrFbvkVbgKkO0dR3BPf9KPYS9P7WYRmKjwoRC66j0Av1TorRULbFqAyE10pHpncvMJG4gv5lgsd6xq0hvvgOou5mnp2gxuU6+4AVy2Q43Zmu7zCQq2fWVWTgmZ/S/NS/x8Bm1f5vl3gSfv60W39z76oFQTgJ7akG+8JizXTZRgehwsKAvUd5c4zo3oLzV/6nTl9DHnttQoxmR1FYLxehT01m+toy/YLkI8pN3VvxJPoaHVJcnqJxEw5NIiFerxyaXnjuTrKWYv1NlJlhQEPoSntcHAR0XRbLtBTM3eG8JSdlZWcBPzeKvK/fUBc9+GiQWOnL6ce6tQBlt2IyByao= X-Forefront-PRVS: 0095BCF226 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(24454002)(377454003)(199003)(43544003)(189002)(47776003)(305945005)(81166006)(4001350100001)(81156014)(3846002)(6116002)(97736004)(106356001)(33656002)(66066001)(7846002)(586003)(23676002)(1076002)(7416002)(77096005)(7736002)(8676002)(92566002)(2950100002)(110136003)(6916009)(4326007)(42186005)(9686002)(105586002)(189998001)(83506001)(6666003)(101416001)(69596002)(2870700001)(68736007)(5660300001)(2906002)(76176999)(86362001)(54356999)(575784001)(21086003)(50466002)(36756003)(19580395003)(19580405001)(50986999)(7099028)(18370500001);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR0401MB1715;H:hgst.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTFVQUjA0MDFNQjE3MTU7MjM6SWQ4RThJQTVIdmFpczNyVXREYkozY2Vx?= =?utf-8?B?VjVCdjg5NitzR1FPcW1LTHNWUDE2UHBKYWZUM2tVY3hlbHJJL1l0dEduWkhK?= =?utf-8?B?azROaHBORUpNZ0dyUGUvTUV3T0RXSUFkM2dxdi9mZEJOQTlUdXRhc0hpcHpF?= =?utf-8?B?RmJ0bDhabU5taTNZTXhBMXlnUDg2S0ZyYmFnb2NENmIwMkV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IAxy92tUMTZQ10nKWBXYjGKEkFVkMy421fKnVtou4e5XRVf1Ze7U40Gmk5X3JnMyXhARY8bf6eL06DDAlxqmGC7zZU65F3LFCzhkvDbfhZEhv9PuOEognyzAippK5KPe7wILH/vco9xsZZCtxHpGqF+A44oZMrOtAvwg89ZyAgiYp3vbM8SiGNSsSkMMfm0=;5:0R9XynQchH1sxfr+1LRolJxHd+fF4bebgN7Gzjb5GqrJyYCmpe7n14gcR/T52Gto6eOu4pW0/FtK/muPivg2biB9p7wSs97+s8mMSh86bG3ebejSWbJ/NW+/VqyJj5RrkmfmaXzssDPpAz//avpcGD7ZS6PYORmE3a9FNiRCyjs=;24:9BpHwuA9hgbxdAdSedUSYcR2D5MmG8KZp8F/R42/IiPOvY5zsSqD7IpEfC/qtetRfsFY/gBBB0deQBUlFWFyQO4EOUXYTuULeTOCBtr0TiM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BLUPR0401MB1715;7:9A9wpqTUth3ZmptWoR13CemG0MPupxRSVMk6FTXToLtPyPPCld+s0fisAChhkKNTCC1xwjAKjnkYBHhAaXkKn3hLotE2gTeqAIZUFom83RsIZSHNV8aow8vGjP1kr7NGHIrEw7TV1/Nb10PghbUWl4JriNl8Cg4insFafE9+4QyK7yW/aY6vzOGQGmXtLd4joQ0YqC2xYg/N7czvw8aNgg/o4/j21H/rEgL2YAJwMKuN+UeymF4calLJmXm9nJfkS/AvTDQ59As5nnQSXlV7XVB2/55ihVVrgZraiDBZKKyz4Dvl76ZoUB2difnxVk6mbvtfUgGEB31SN3BjNZsok5uuReBqCmgEWISWTPCdhr0=;20:DQRvLzqTkH7psuCbQLluxxdIMetT/35nc0+GqJphvsN1fqSajFfMovNf0Lr3+P0tVOpp04dptW3qNuNDzd/2/mDeT1tP6TII0Y/yG39KHdvHcUbp1nUaUZ+GXI/AF4gmGrND7/zUN+wvdM6Ft5aqg7BB+CFC4ouzMj1gLx6MG6ZeTYv1Z9Nc3LttXiNUbkgT7G4GXCpNtbduNBHem1l31y4JwdiGkRUUDuvQT7cYOUJqn4iJ0MnVJvhLtQIOTzq/ X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2016 18:36:02.2949 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0401MB1715 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3137 Lines: 87 The 10/14/2016 07:54, Hannes Reinecke wrote: > On 10/13/2016 09:53 PM, Adam Manzanares wrote: > > Patch adds an association between iocontext ioprio and the ioprio of a > > request. This value 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); > > > Don't you need to check for 'ioprio_valid()' here, too? I poked around and it should be safe to not check for ioprio valid at this point. ioprio_valid only checks to see if the ioprio is not IOPRIO_CLASS_NONE. The request by default has a ioprio of none so if the ioc has ioprio of none we are not changing anything. The locations in the code that I found where the ioc prio is set are either filtered through the syscall handler, which checks for invalid priority combinations, or have valid priority values. Take care, Adam > > Cheers, > > Hannes > -- > Dr. Hannes Reinecke Teamlead Storage & Networking > hare@suse.de +49 911 74053 688 > SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg > GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton > HRB 21284 (AG Nürnberg)