[PATCH 6/8] blk-iocost: Avoid to call current_hweight_max if iocg->inuse == iocg->active

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

 



The old_hwi is already max hweight_inuse if iocg->inuse == iocg->active.
Remove unnecessary calculation.

Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxx>
---
 block/blk-iocost.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index 96c1571a8a1d..fa90f471dfdc 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -2299,7 +2299,10 @@ static void ioc_timer_fn(struct timer_list *timer)
 			 * Determine the donation amount.
 			 */
 			current_hweight(iocg, &hwa, &old_hwi);
-			hwm = current_hweight_max(iocg);
+			if (iocg->inuse == iocg->active)
+				hwm = old_hwi;
+			else
+				hwm = current_hweight_max(iocg);
 			new_hwi = hweight_after_donation(iocg, old_hwi, hwm,
 							 usage, &now);
 			/*
-- 
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