Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753303AbbGPOkr (ORCPT ); Thu, 16 Jul 2015 10:40:47 -0400 Received: from mail-yk0-f182.google.com ([209.85.160.182]:36531 "EHLO mail-yk0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752086AbbGPOkq (ORCPT ); Thu, 16 Jul 2015 10:40:46 -0400 Date: Thu, 16 Jul 2015 10:40:43 -0400 From: Tejun Heo To: Ming Lei Cc: Jens Axboe , linux-kernel@vger.kernel.org, Mike Snitzer Subject: Re: [PATCH 4/4] block: account io: convert part->in_fligh[] into percpu variable Message-ID: <20150716144043.GU15934@mtj.duckdns.org> References: <1437016607-375-1-git-send-email-tom.leiming@gmail.com> <1437016607-375-5-git-send-email-tom.leiming@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1437016607-375-5-git-send-email-tom.leiming@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1306 Lines: 41 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/