Patch "blk-cgroup: don't update io stat for root cgroup" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    blk-cgroup: don't update io stat for root cgroup

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     blk-cgroup-don-t-update-io-stat-for-root-cgroup.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 527c91479bffb990d54c25cab35fdc3629d3f774
Author: Ming Lei <ming.lei@xxxxxxxxxx>
Date:   Thu Feb 2 10:18:04 2023 +0800

    blk-cgroup: don't update io stat for root cgroup
    
    [ Upstream commit 0416f3be58c6b1ea066cd52e354b857693feb01e ]
    
    We source root cgroup stats from the system-wide stats, see blkcg_print_stat
    and blkcg_rstat_flush, so don't update io state for root cgroup.
    
    Fixes blkg leak issue introduced in commit 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()")
    which starts to grab blkg's reference when adding iostat_cpu into percpu
    blkcg list, but this state won't be consumed by blkcg_rstat_flush() where
    the blkg reference is dropped.
    
    Tested-by: Bart van Assche <bvanassche@xxxxxxx>
    Reported-by: Bart van Assche <bvanassche@xxxxxxx>
    Fixes: 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()")
    Cc: Tejun Heo <tj@xxxxxxxxxx>
    Cc: Waiman Long <longman@xxxxxxxxxx>
    Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230202021804.278582-1-ming.lei@xxxxxxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Stable-dep-of: ad7c3b41e86b ("blk-throttle: Fix io statistics for cgroup v1")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 2c7be256ff879..5ee0ae8ddbf6f 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -2008,6 +2008,10 @@ void blk_cgroup_bio_start(struct bio *bio)
 	struct blkg_iostat_set *bis;
 	unsigned long flags;
 
+	/* Root-level stats are sourced from system-wide IO stats */
+	if (!cgroup_parent(blkcg->css.cgroup))
+		return;
+
 	cpu = get_cpu();
 	bis = per_cpu_ptr(bio->bi_blkg->iostat_cpu, cpu);
 	flags = u64_stats_update_begin_irqsave(&bis->sync);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux