[PATCH 01/10] block, bfq: correctly raise inject limit in bfq_choose_bfqq_for_injection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Inject limit could be temporarily raised if current inject_limit is 0.
raised limit is saved in local variable "limit". The traverse below will
reset raised "limit" to bfqd->in_service_queue which is 0 for limit
raised condition and will invalidate the raised limit.

After passing bfqd->rq_in_driver >= limit check above, we can be sure
about two things in traverse:
1. Local variable "limit" is greater than 0 or bfqd->rq_in_driver >= limit
check is always met.
2. For normal case (else case for large request to non-rotational drives),
no need to check bfqd->rq_in_driver < limit again if local variable
"limit" is not changed.

Fix this by not overwriting local variable "limit" in traverse. As
metioned in first thing above that limit is greater than 0, so result of
min_t(unsigned int, 1, limit) is always 1. we can simply check whether
rq_in_driver is less than 1 for case of large request to non-rotational
drives and remove assignment to local variable "limit" in traverse. As
metioned in second thing above, in normal case no futher check is needed
if local variable "limit" is not chaged, so return directly in normal
case.

Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxx>
---
 block/bfq-iosched.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index 7ea427817f7f..b0bee8ab65e6 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -4707,12 +4707,10 @@ bfq_choose_bfqq_for_injection(struct bfq_data *bfqd)
 			 */
 			if (blk_queue_nonrot(bfqd->queue) &&
 			    blk_rq_sectors(bfqq->next_rq) >=
-			    BFQQ_SECT_THR_NONROT)
-				limit = min_t(unsigned int, 1, limit);
-			else
-				limit = in_serv_bfqq->inject_limit;
-
-			if (bfqd->rq_in_driver < limit) {
+			    BFQQ_SECT_THR_NONROT &&
+			    bfqd->rq_in_driver >= 1)
+				continue;
+			else {
 				bfqd->rqs_injected = true;
 				return bfqq;
 			}
-- 
2.30.0




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux