[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150716144043.GU15934@mtj.duckdns.org>
Date: Thu, 16 Jul 2015 10:40:43 -0400
From: Tejun Heo <tj@...nel.org>
To: Ming Lei <tom.leiming@...il.com>
Cc: Jens Axboe <axboe@...nel.dk>, linux-kernel@...r.kernel.org,
Mike Snitzer <snitzer@...hat.com>
Subject: Re: [PATCH 4/4] block: account io: convert part->in_fligh[] into
percpu variable
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists