]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - block/blk-throttle.c
blk-throttle: generalize update_disptime optimization in blk_throtl_bio()
authorTejun Heo <tj@kernel.org>
Tue, 14 May 2013 20:52:35 +0000 (13:52 -0700)
committerTejun Heo <tj@kernel.org>
Tue, 14 May 2013 20:52:35 +0000 (13:52 -0700)
commit0e9f4164ba915052918a77ecb2a59822dbfd661c
tree3b9756ee1b216b9f8a9ed5e53623e4036971912b
parent651930bc1c2a2550fde93a8cfa1a201c363a0ca1
blk-throttle: generalize update_disptime optimization in blk_throtl_bio()

When blk_throtl_bio() wants to queue a bio to a tg (throtl_grp), it
avoids invoking tg_update_disptime() and
throtl_schedule_next_dispatch() if the tg already has bios queued in
that direction.  As a new bio is appeneded after the existing ones, it
can't change the tg's next dispatch time or the parent's dispatch
schedule.

This optimization is currently open coded in blk_throtl_bio().
Whether the target biolist was occupied was recorded in a local
variable and later used to skip disptime update.  This patch moves
generalizes it so that throtl_add_bio_tg() sets a new flag
THROTL_TG_WAS_EMPTY if the biolist was empty before the new bio was
added.  tg_update_disptime() clears the flag automatically.
blk_throtl_bio() is updated to simply test the flag before updating
disptime.

This patch doesn't make any functional differences now but will enable
using the same optimization for recursive dispatch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
block/blk-throttle.c