• Tejun Heo's avatar
    blkcg: make blkcg_[rw]stat per-cpu · 24bdb8ef
    Tejun Heo authored
    blkcg_[rw]stat are used as stat counters for blkcg policies.  It isn't
    per-cpu by itself and blk-throttle makes it per-cpu by wrapping around
    it.  This patch makes blkcg_[rw]stat per-cpu and drop the ad-hoc
    per-cpu wrapping in blk-throttle.
    * blkg_[rw]stat->cnt is replaced with cpu_cnt which is struct
      percpu_counter.  This makes syncp unnecessary as remote accesses are
      handled by percpu_counter itself.
    * blkg_[rw]stat_init() can now fail due to percpu allocation failure
      and thus are updated to return int.
    * percpu_counters need explicit freeing.  blkg_[rw]stat_exit() added.
    * As blkg_rwstat->cpu_cnt[] can't be read directly anymore, reading
      and summing results are stored in ->aux_cnt[] instead.
    * Custom per-cpu stat implementation in blk-throttle is removed.
    This makes all blkcg stat counters per-cpu without complicating policy
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Cc: Vivek Goyal <vgoyal@redhat.com>
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
blk-cgroup.h 21.2 KB