Return-Path: Subject: Re: [PATCH 5/6] blk-mq: enable checking two part inflight counts at the same time To: Omar Sandoval Cc: linux-block@vger.kernel.org, brking@linux.vnet.ibm.com, bart.vanassche@wdc.com References: <1501859062-11120-1-git-send-email-axboe@kernel.dk> <1501859062-11120-6-git-send-email-axboe@kernel.dk> <20170808224800.GG4072@vader.DHCP.thefacebook.com> <78566b09-d53c-811e-4bd5-c15cdea2e50a@kernel.dk> <20170809071431.GB16843@vader> From: Jens Axboe Message-ID: <8b9d6c36-ebf5-ba12-c03a-4175b2c6d0fe@kernel.dk> Date: Wed, 9 Aug 2017 08:13:44 -0600 MIME-Version: 1.0 In-Reply-To: <20170809071431.GB16843@vader> Content-Type: text/plain; charset=utf-8 List-ID: On 08/09/2017 01:14 AM, Omar Sandoval wrote: > On Tue, Aug 08, 2017 at 05:47:15PM -0600, Jens Axboe wrote: >> On 08/08/2017 04:48 PM, Omar Sandoval wrote: >>> On Fri, Aug 04, 2017 at 09:04:21AM -0600, Jens Axboe wrote: >>>> Modify blk_mq_in_flight() to count both a partition and root at >>>> the same time. Then we only have to call it once, instead of >>>> potentially looping the tags twice. >>> >>> Reviewed-by: Omar Sandoval >>> >>> One comment below. >>> >>>> Signed-off-by: Jens Axboe >>> >>> [snip] >>> >>>> diff --git a/block/blk-mq.c b/block/blk-mq.c >>>> index fe1aa1f5f069..410ed246bc9b 100644 >>>> --- a/block/blk-mq.c >>>> +++ b/block/blk-mq.c >>>> @@ -98,11 +98,13 @@ static void blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx, >>>> return; >>>> >>>> /* >>>> - * Count as inflight if it either matches the partition we asked >>>> - * for, or if it's the root >>>> + * Count as inflight if it matches the partition, count separately >>>> + * (but all) if we got asked for the root >>>> */ >>>> - if (rq->part == mi->part || mi->part->partno) >>>> + if (rq->part == mi->part) >>>> mi->inflight[0]++; >>> >>> Similar concern as with patch 3, why special case the part0 case below? >> >> Not sure I follow, both are initialized for this case. Or do you mean >> the increment? > > Yeah I mean the increment. If I'm reading this right, for the !part0 > case, inflight[0] is the count of in-flight requests for the partition > and inflight[1] is the count of in-flight requests for the whole device. > For the part0 case, inflight[0] is the count of in-flight requests for > the root device and inflight[1] is always 0. Can we make inflight[1] the > same in the part0 and !part0 cases? Not sure that would change much. [0] is indeed the exact partition. That's always the case. [1] is always the root, except if [0] is. We just don't want to count it twice. So I'd argue they are the same :-) -- Jens Axboe