linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iocost: check active_list of all the ancestors in iocg_activate()
@ 2019-11-13  7:21 Jiufei Xue
  2019-11-13 16:20 ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Jiufei Xue @ 2019-11-13  7:21 UTC (permalink / raw)
  To: axboe, tj; +Cc: cgroups, linux-block, joseph.qi, Jiufei Xue

There is a bug that checking the same active_list over and over again
in iocg_activate(). The intention of the code was checking whether all
the ancestors and self have already been activated. So fix it.

Signed-off-by: Jiufei Xue <jiufei.xue@linux.alibaba.com>
---
 block/blk-iocost.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index a7ed434..e01267f 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -1057,9 +1057,12 @@ static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now)
 	atomic64_set(&iocg->active_period, cur_period);
 
 	/* already activated or breaking leaf-only constraint? */
-	for (i = iocg->level; i > 0; i--)
-		if (!list_empty(&iocg->active_list))
+	if (!list_empty(&iocg->active_list))
+		goto succeed_unlock;
+	for (i = iocg->level - 1; i > 0; i--)
+		if (!list_empty(&iocg->ancestors[i]->active_list))
 			goto fail_unlock;
+
 	if (iocg->child_active_sum)
 		goto fail_unlock;
 
@@ -1101,6 +1104,7 @@ static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now)
 		ioc_start_period(ioc, now);
 	}
 
+succeed_unlock:
 	spin_unlock_irq(&ioc->lock);
 	return true;
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iocost: check active_list of all the ancestors in iocg_activate()
  2019-11-13  7:21 [PATCH] iocost: check active_list of all the ancestors in iocg_activate() Jiufei Xue
@ 2019-11-13 16:20 ` Tejun Heo
  2019-11-14 20:57   ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2019-11-13 16:20 UTC (permalink / raw)
  To: Jiufei Xue; +Cc: axboe, cgroups, linux-block, joseph.qi

On Wed, Nov 13, 2019 at 03:21:31PM +0800, Jiufei Xue wrote:
> There is a bug that checking the same active_list over and over again
> in iocg_activate(). The intention of the code was checking whether all
> the ancestors and self have already been activated. So fix it.
> 
> Signed-off-by: Jiufei Xue <jiufei.xue@linux.alibaba.com>

Fixes: 7caa47151ab2 ("blkcg: implement blk-iocost")
Acked-by: Tejun Heo <tj@kernel.org>

Jens, can you please apply this patch?

Thans.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iocost: check active_list of all the ancestors in iocg_activate()
  2019-11-13 16:20 ` Tejun Heo
@ 2019-11-14 20:57   ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2019-11-14 20:57 UTC (permalink / raw)
  To: Tejun Heo, Jiufei Xue; +Cc: cgroups, linux-block, joseph.qi

On 11/13/19 9:20 AM, Tejun Heo wrote:
> On Wed, Nov 13, 2019 at 03:21:31PM +0800, Jiufei Xue wrote:
>> There is a bug that checking the same active_list over and over again
>> in iocg_activate(). The intention of the code was checking whether all
>> the ancestors and self have already been activated. So fix it.
>>
>> Signed-off-by: Jiufei Xue <jiufei.xue@linux.alibaba.com>
> 
> Fixes: 7caa47151ab2 ("blkcg: implement blk-iocost")
> Acked-by: Tejun Heo <tj@kernel.org>
> 
> Jens, can you please apply this patch?

Applied for 5.4, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-14 20:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13  7:21 [PATCH] iocost: check active_list of all the ancestors in iocg_activate() Jiufei Xue
2019-11-13 16:20 ` Tejun Heo
2019-11-14 20:57   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).