Skip to content

Commit

Permalink
blk-throttle: Move service tree validation out of the throtl_rb_first()
Browse files Browse the repository at this point in the history
The throtl_schedule_next_dispatch() will validate if the service queue
is empty before calling update_min_dispatch_time(), and the
update_min_dispatch_time() will call throtl_rb_first(), which will
validate service queue again.

Thus we can move the service queue validation out of the
throtl_rb_first() to remove the redundant validation in the fast path.

Signed-off-by: Baolin Wang <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Baolin Wang authored and axboe committed Oct 8, 2020
1 parent b7b609d commit 2397611
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,6 @@ static struct throtl_grp *
throtl_rb_first(struct throtl_service_queue *parent_sq)
{
struct rb_node *n;
/* Service tree is empty */
if (!parent_sq->nr_pending)
return NULL;

n = rb_first_cached(&parent_sq->pending_tree);
WARN_ON_ONCE(!n);
Expand Down Expand Up @@ -1224,9 +1221,13 @@ static int throtl_select_dispatch(struct throtl_service_queue *parent_sq)
unsigned int nr_disp = 0;

while (1) {
struct throtl_grp *tg = throtl_rb_first(parent_sq);
struct throtl_grp *tg;
struct throtl_service_queue *sq;

if (!parent_sq->nr_pending)
break;

tg = throtl_rb_first(parent_sq);
if (!tg)
break;

Expand Down

0 comments on commit 2397611

Please sign in to comment.