Skip to content

Commit

Permalink
block: don't check bio in blk_throtl_dispatch_work_fn
Browse files Browse the repository at this point in the history
The bio has been checked already before throttling, so no need to check
it again before dispatching it from throttle queue.

Add a helper of submit_bio_noacct_nocheck() for this purpose.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220216044514.2903784-5-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Ming Lei authored and Jens Axboe committed Feb 17, 2022
1 parent 29ff236 commit 3f98c75
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
30 changes: 17 additions & 13 deletions block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,20 +874,8 @@ static void __submit_bio_noacct_mq(struct bio *bio)
current->bio_list = NULL;
}

/**
* submit_bio_noacct - re-submit a bio to the block device layer for I/O
* @bio: The bio describing the location in memory and on the device.
*
* This is a version of submit_bio() that shall only be used for I/O that is
* resubmitted to lower level drivers by stacking block drivers. All file
* systems and other upper level users of the block layer should use
* submit_bio() instead.
*/
void submit_bio_noacct(struct bio *bio)
void submit_bio_noacct_nocheck(struct bio *bio)
{
if (unlikely(!submit_bio_checks(bio)))
return;

/*
* We only want one ->submit_bio to be active at a time, else stack
* usage with stacked devices could be a problem. Use current->bio_list
Expand All @@ -901,6 +889,22 @@ void submit_bio_noacct(struct bio *bio)
else
__submit_bio_noacct(bio);
}

/**
* submit_bio_noacct - re-submit a bio to the block device layer for I/O
* @bio: The bio describing the location in memory and on the device.
*
* This is a version of submit_bio() that shall only be used for I/O that is
* resubmitted to lower level drivers by stacking block drivers. All file
* systems and other upper level users of the block layer should use
* submit_bio() instead.
*/
void submit_bio_noacct(struct bio *bio)
{
if (unlikely(!submit_bio_checks(bio)))
return;
submit_bio_noacct_nocheck(bio);
}
EXPORT_SYMBOL(submit_bio_noacct);

/**
Expand Down
2 changes: 1 addition & 1 deletion block/blk-throttle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ static void blk_throtl_dispatch_work_fn(struct work_struct *work)
if (!bio_list_empty(&bio_list_on_stack)) {
blk_start_plug(&plug);
while ((bio = bio_list_pop(&bio_list_on_stack)))
submit_bio_noacct(bio);
submit_bio_noacct_nocheck(bio);
blk_finish_plug(&plug);
}
}
Expand Down
1 change: 1 addition & 0 deletions block/blk.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ void blk_freeze_queue(struct request_queue *q);
void __blk_mq_unfreeze_queue(struct request_queue *q, bool force_atomic);
void blk_queue_start_drain(struct request_queue *q);
int __bio_queue_enter(struct request_queue *q, struct bio *bio);
void submit_bio_noacct_nocheck(struct bio *bio);

static inline bool blk_try_enter_queue(struct request_queue *q, bool pm)
{
Expand Down

0 comments on commit 3f98c75

Please sign in to comment.