From: Tejun Heo <tj@kernel.org>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-kernel@vger.kernel.org, Mike Snitzer <snitzer@redhat.com>
Subject: Re: [PATCH 4/4] block: account io: convert part->in_fligh[] into percpu variable
Date: Thu, 16 Jul 2015 10:40:43 -0400 [thread overview]
Message-ID: <20150716144043.GU15934@mtj.duckdns.org> (raw)
In-Reply-To: <1437016607-375-5-git-send-email-tom.leiming@gmail.com>
Hello,
On Thu, Jul 16, 2015 at 11:16:47AM +0800, Ming Lei wrote:
...
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -651,9 +651,9 @@ static void start_io_acct(struct dm_io *io)
>
> cpu = part_stat_lock();
> part_round_stats(cpu, &dm_disk(md)->part0);
> + part_stat_set(cpu, &dm_disk(md)->part0, in_flight[rw],
> + atomic_inc_return(&md->pending[rw]));
> part_stat_unlock();
> - atomic_set(&dm_disk(md)->part0.in_flight[rw],
> - atomic_inc_return(&md->pending[rw]));
Why is this correct? Isn't the code trying to transfer its stat to
block stat verbatim? Why does part_stat_set() have @cpu param at all?
Shouldn't it clear the whole thing and set one of the cpu counters to
the target value?
> @@ -679,7 +679,9 @@ static void end_io_acct(struct dm_io *io)
> * a flush.
> */
> pending = atomic_dec_return(&md->pending[rw]);
> - atomic_set(&dm_disk(md)->part0.in_flight[rw], pending);
> + cpu = part_stat_lock();
> + part_stat_set(cpu, &dm_disk(md)->part0, in_flight[rw], pending);
> + part_stat_unlock();
Ditto.
Thanks.
--
tejun
next prev parent reply other threads:[~2015-07-16 14:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-16 3:16 [PATCH 0/4] block: account io: kill atomic operations Ming Lei
2015-07-16 3:16 ` [PATCH 1/4] block: partition: introduce hd_free_part() Ming Lei
2015-07-16 3:16 ` [PATCH 2/4] block: partition: convert percpu ref Ming Lei
2015-07-16 14:36 ` Tejun Heo
2015-07-16 3:16 ` [PATCH 3/4] block: partition: introduce 'cpu' para to part_inc|dec_in_flight Ming Lei
2015-07-16 3:16 ` [PATCH 4/4] block: account io: convert part->in_fligh[] into percpu variable Ming Lei
2015-07-16 14:40 ` Tejun Heo [this message]
2015-07-16 14:48 ` [PATCH 0/4] block: account io: kill atomic operations Jens Axboe
2015-07-16 14:59 ` Tejun Heo
2015-07-16 15:02 ` Jens Axboe
2015-07-16 15:01 ` Ming Lei
2015-07-16 15:09 ` 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=20150716144043.GU15934@mtj.duckdns.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=snitzer@redhat.com \
--cc=tom.leiming@gmail.com \
/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
all inboxes | Powered by JetHome®