From: Jerome Marchand <jmarchan@redhat.com>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: linux-kernel@vger.kernel.org, Nikanth Karthikesan <knikanth@suse.de>
Subject: Re: [PATCH v2] block: simplify I/O stat accounting
Date: Fri, 17 Apr 2009 14:24:34 +0200 [thread overview]
Message-ID: <49E87502.3050806@redhat.com> (raw)
In-Reply-To: <20090417115449.GV4593@kernel.dk>
Jens Axboe wrote:
> On Fri, Apr 17 2009, Jens Axboe wrote:
>> On second thought, not sure why you add 'iostat' for this. It would be
>> OK to just do
>>
>> if (blk_queue_io_stat(q))
>> rw_flags |= REQ_IO_STAT;
>>
>> since it's just used for the allocation call, and the trace call (which
>> does & 1 on it anyway).
>>
OK.
>>> diff --git a/block/blk-merge.c b/block/blk-merge.c
>>> index 63760ca..6a05270 100644
>>> --- a/block/blk-merge.c
>>> +++ b/block/blk-merge.c
>>> @@ -338,9 +338,9 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
>>> return 1;
>>> }
>>>
>>> -static void blk_account_io_merge(struct request *req)
>>> +static void blk_account_io_merge(struct request *req, struct request *next)
>>> {
>>> - if (blk_do_io_stat(req)) {
>>> + if (req->rq_disk && blk_rq_io_stat(next)) {
>> This at least needs a comment, it's not at all directly clear why we are
>> checking 'next' for io stat and ->rq_disk in 'req'. Since it's just
>> called from that one spot, it would be cleaner to do:
>>
>> /*
>> * 'next' is going away, so update stats accordingly
>> */
>> if (blk_rq_io_stat(next))
>> blk_account_io_merge(req->rq_disk, req->sector);
>>
>> and have blk_account_io_merge() be more ala:
>>
>> static void blk_account_io_merge(struct request *req)
>> {
>> struct hd_struct *part;
>> int cpu;
>>
>> cpu = part_stat_lock();
>> part = disk_map_sector_rcu(disk, sector);
>> ...
>> }
>
> BTW, it seems there's a current problem with this construct. If 'req'
> and 'next' reside on different partitions, the accounting will be wrong.
> This wont happen with normal fs activity of course, but it's definitely
> possible with buffered (or O_DIRECT) IO on the full device.
>
You're right. We may end up decrease in_flight on the wrong partition.
I think having blk_account_io_merge() unchanged but call it for next
request would solve that:
- blk_account_io_merge(req)
+ blk_account_io_merge(next)
We would still have the request payload accounted to the wrong partition
(as it always was), but I don't think that small inaccuracy really matters.
Jérôme
next prev parent reply other threads:[~2009-04-17 12:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-16 13:14 [PATCH] block: simplify I/O stat accounting Jerome Marchand
2009-04-16 16:34 ` Jens Axboe
2009-04-16 16:37 ` Jens Axboe
2009-04-16 16:38 ` Jens Axboe
2009-04-16 16:42 ` Jens Axboe
2009-04-17 8:03 ` Jerome Marchand
2009-04-17 11:21 ` [PATCH v2] " Jerome Marchand
2009-04-17 11:37 ` Jens Axboe
2009-04-17 11:54 ` Jens Axboe
2009-04-17 12:24 ` Jerome Marchand [this message]
2009-04-17 12:30 ` Jens Axboe
2009-04-21 13:32 ` [PATCH v3] " Jerome Marchand
2009-04-22 12:16 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49E87502.3050806@redhat.com \
--to=jmarchan@redhat.com \
--cc=jens.axboe@oracle.com \
--cc=knikanth@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox