Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp659528pxb; Tue, 5 Apr 2022 17:40:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8DYVsUvCqdV4v3cO2/cp8x07U6Yasso0dbVex1igUz3BCAn+WCmUA2NXXF/s8qeurZxK1 X-Received: by 2002:a17:906:9b95:b0:6e0:6f6b:997 with SMTP id dd21-20020a1709069b9500b006e06f6b0997mr5756703ejc.367.1649205636175; Tue, 05 Apr 2022 17:40:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649205636; cv=none; d=google.com; s=arc-20160816; b=aRtBrwtzZ5JS5pBTgi5t9eGOn678DIAHeoTTgEi8hlfRzVSBdcN4u9qdlSim6vbMt1 3XZSvT3i7ITpiZ6SneURK3XXvfu4iC5HnZ+KC2KfiK5NU6o3G/jCk7uDt7mZf2L5qHS4 S5OgUojdJwZvHr6CU3c+dfEpBUL3HmhAG9ok5ni8X82cZ1D/4Way58wNv79Jf8JxyXIT 4l/YoQjNLrHoRwk5yXnyz2HaFZKhc58YBnbCWWnqjYfa/6aYcFIGBuWiGN0DGSTkN52Z am7jk/YAo3EuUh2k5S2r5gJuM9egNJC7+FBCJGjNSHRejB0Bd1bRhwJ+yhcSPLA+biv4 hX0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=C8tOzDKaPE349aMbTWqNrZGAvJVMSGVHYD3i4f0wZQs=; b=pJ0r+9XQygEIsONWn+tTF/VqXDqgRNdEiLDQjPu2KaIfEUd1DaX3MejG9rjXKDrbHr eIqyDiOOgWBTecYGXxrRmAAghyr2lh1twZL1vPKBxW7s1N1Pb2y8wIhxXy+hKLM82zgm CBUUUBpve1vI7AejsBcf0iJwNU1JgWV/AgwWm7AucwUiyr5rJrnpbgtcJl75aT+/Yo+r VW3c3dKgQgpbkjY+vKfTbbT9dEhe0+UK4qYAz2lgJ5ft3tKAhZn/q8wBA+GBBlkoBUVw Yi2fcFpDQThTsFcdX+UElltz9dwyfx/X4UH8HD7EdM1h4xVaxaT6N8/6u9TJS3n5621+ +wbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tLs0Kh7A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a056402005400b0041ccfb1113esi5425617edu.563.2022.04.05.17.40.03; Tue, 05 Apr 2022 17:40:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tLs0Kh7A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352597AbiDEO4Q (ORCPT + 99 others); Tue, 5 Apr 2022 10:56:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344439AbiDEJmC (ORCPT ); Tue, 5 Apr 2022 05:42:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB913BD8A9; Tue, 5 Apr 2022 02:27:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5D21FB81C9D; Tue, 5 Apr 2022 09:27:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6B27C385A0; Tue, 5 Apr 2022 09:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150858; bh=Tl3i0G1oLIlf2N5uHEZAbbKXNZ7qzOlT5BkbEXs7HhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tLs0Kh7ApBOrmn8NoJAppV5C7CN6Dc1v18uUBv2MZzoV3UigEeVjtJ/ZUgKC3PLkk xacI8p+c06KOKPcY9Ry0GgSnbZlz2ysHnJTT0gllRBcVhETfxUNccsVHL/7mgcE+Vq KiGq/L8fi83eZPASbTjny1GW1Y9PAmudVUow8wn8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chengming Zhou , Tejun Heo , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 205/913] blk-cgroup: set blkg iostat after percpu stat aggregation Date: Tue, 5 Apr 2022 09:21:07 +0200 Message-Id: <20220405070346.004282448@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chengming Zhou [ Upstream commit f122d103b564e5fb7c82de902c6f8f6cbdf50ec9 ] Don't need to do blkg_iostat_set for top blkg iostat on each CPU, so move it after percpu stat aggregation. Fixes: ef45fe470e1e ("blk-cgroup: show global disk stats in root cgroup io.stat") Signed-off-by: Chengming Zhou Acked-by: Tejun Heo Link: https://lore.kernel.org/r/20220213085902.88884-1-zhouchengming@bytedance.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-cgroup.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 0eec59e4df65..07a2524e6efd 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -855,11 +855,11 @@ static void blkcg_fill_root_iostats(void) blk_queue_root_blkg(bdev->bd_disk->queue); struct blkg_iostat tmp; int cpu; + unsigned long flags; memset(&tmp, 0, sizeof(tmp)); for_each_possible_cpu(cpu) { struct disk_stats *cpu_dkstats; - unsigned long flags; cpu_dkstats = per_cpu_ptr(bdev->bd_stats, cpu); tmp.ios[BLKG_IOSTAT_READ] += @@ -875,11 +875,11 @@ static void blkcg_fill_root_iostats(void) cpu_dkstats->sectors[STAT_WRITE] << 9; tmp.bytes[BLKG_IOSTAT_DISCARD] += cpu_dkstats->sectors[STAT_DISCARD] << 9; - - flags = u64_stats_update_begin_irqsave(&blkg->iostat.sync); - blkg_iostat_set(&blkg->iostat.cur, &tmp); - u64_stats_update_end_irqrestore(&blkg->iostat.sync, flags); } + + flags = u64_stats_update_begin_irqsave(&blkg->iostat.sync); + blkg_iostat_set(&blkg->iostat.cur, &tmp); + u64_stats_update_end_irqrestore(&blkg->iostat.sync, flags); } } -- 2.34.1