]> git.baikalelectronics.ru Git - kernel.git/commit
blkcg: simplify statistic accumulation code
authorArnd Bergmann <arnd@arndb.de>
Tue, 16 Jan 2018 15:01:36 +0000 (16:01 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 16 Jan 2018 15:56:36 +0000 (08:56 -0700)
commitbd89030ff5924e5ce1bc715c82e090122be6c26e
tree615916e0440e3301e08a47924f437b724d8b0749
parentb7cbe840591be4507f2db7053be157214caa2cf5
blkcg: simplify statistic accumulation code

Some older compilers (gcc-4.4 through 4.6 in particular) struggle
with the way that blkg_rwstat_read() returns a structure, leading
to excessive stack usage and rather inefficient code:

block/blk-cgroup.c: In function 'blkg_destroy':
block/blk-cgroup.c:354:1: error: the frame size of 1296 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
block/cfq-iosched.c: In function 'cfqg_stats_add_aux':
block/cfq-iosched.c:753:1: error: the frame size of 1928 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
block/bfq-cgroup.c: In function 'bfqg_stats_add_aux':
block/bfq-cgroup.c:299:1: error: the frame size of 1928 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

I also notice that there is no point in using atomic accesses
for the local variables, so storing the temporaries in simple 'u64'
variables not only avoids the stack usage on older compilers but
also improves the object code on modern versions.

Fixes: b88732005863 ("blkcg: add blkg_[rw]stat->aux_cnt and replace cfq_group->dead_stats with it")
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/blk-cgroup.h