* Re: [PATCH v2] blk-throttle: fix possible io stall when upgrade to max
2017-09-30 6:38 [PATCH v2] blk-throttle: fix possible io stall when upgrade to max Joseph Qi
@ 2017-09-30 6:02 ` Shaohua Li
2017-10-03 21:42 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Shaohua Li @ 2017-09-30 6:02 UTC (permalink / raw)
To: Joseph Qi
Cc: linux-block, Jens Axboe, Shaohua Li, boyu.mt, wenqing.lz, qijiang.qj
On Sat, Sep 30, 2017 at 02:38:49PM +0800, Joseph Qi wrote:
> From: Joseph Qi <qijiang.qj@alibaba-inc.com>
>
> There is a case which will lead to io stall. The case is described as
> follows.
> /test1
> |-subtest1
> /test2
> |-subtest2
> And subtest1 and subtest2 each has 32 queued bios already.
>
> Now upgrade to max. In throtl_upgrade_state, it will try to dispatch
> bios as follows:
> 1) tg=subtest1, do nothing;
> 2) tg=test1, transfer 32 queued bios from subtest1 to test1; no pending
> left, no need to schedule next dispatch;
> 3) tg=subtest2, do nothing;
> 4) tg=test2, transfer 32 queued bios from subtest2 to test2; no pending
> left, no need to schedule next dispatch;
> 5) tg=/, transfer 8 queued bios from test1 to /, 8 queued bios from
> test2 to /, 8 queued bios from test1 to /, and 8 queued bios from test2
> to /; note that test1 and test2 each still has 16 queued bios left;
> 6) tg=/, try to schedule next dispatch, but since disptime is now
> (update in tg_update_disptime, wait=0), pending timer is not scheduled
> in fact;
> 7) In throtl_upgrade_state it totally dispatches 32 queued bios and with
> 32 left. test1 and test2 each has 16 queued bios;
> 8) throtl_pending_timer_fn sees the left over bios, but could do
> nothing, because throtl_select_dispatch returns 0, and test1/test2 has
> no pending tg.
>
> The blktrace shows the following:
> 8,32 0 0 2.539007641 0 m N throtl upgrade to max
> 8,32 0 0 2.539072267 0 m N throtl /test2 dispatch nr_queued=16 read=0 write=16
> 8,32 7 0 2.539077142 0 m N throtl /test1 dispatch nr_queued=16 read=0 write=16
>
> So force schedule dispatch if there are pending children.
>
> Signed-off-by: Joseph Qi <qijiang.qj@alibaba-inc.com>
> ---
> block/blk-throttle.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/blk-throttle.c b/block/blk-throttle.c
> index 0fea76a..17816a0 100644
> --- a/block/blk-throttle.c
> +++ b/block/blk-throttle.c
> @@ -1911,11 +1911,11 @@ static void throtl_upgrade_state(struct throtl_data *td)
>
> tg->disptime = jiffies - 1;
> throtl_select_dispatch(sq);
> - throtl_schedule_next_dispatch(sq, false);
> + throtl_schedule_next_dispatch(sq, true);
> }
> rcu_read_unlock();
> throtl_select_dispatch(&td->service_queue);
> - throtl_schedule_next_dispatch(&td->service_queue, false);
> + throtl_schedule_next_dispatch(&td->service_queue, true);
> queue_work(kthrotld_workqueue, &td->dispatch_work);
> }
Reviewed-by: Shaohua Li <shli@fb.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] blk-throttle: fix possible io stall when upgrade to max
@ 2017-09-30 6:38 Joseph Qi
2017-09-30 6:02 ` Shaohua Li
2017-10-03 21:42 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Joseph Qi @ 2017-09-30 6:38 UTC (permalink / raw)
To: linux-block; +Cc: Jens Axboe, Shaohua Li, boyu.mt, wenqing.lz, qijiang.qj
From: Joseph Qi <qijiang.qj@alibaba-inc.com>
There is a case which will lead to io stall. The case is described as
follows.
/test1
|-subtest1
/test2
|-subtest2
And subtest1 and subtest2 each has 32 queued bios already.
Now upgrade to max. In throtl_upgrade_state, it will try to dispatch
bios as follows:
1) tg=subtest1, do nothing;
2) tg=test1, transfer 32 queued bios from subtest1 to test1; no pending
left, no need to schedule next dispatch;
3) tg=subtest2, do nothing;
4) tg=test2, transfer 32 queued bios from subtest2 to test2; no pending
left, no need to schedule next dispatch;
5) tg=/, transfer 8 queued bios from test1 to /, 8 queued bios from
test2 to /, 8 queued bios from test1 to /, and 8 queued bios from test2
to /; note that test1 and test2 each still has 16 queued bios left;
6) tg=/, try to schedule next dispatch, but since disptime is now
(update in tg_update_disptime, wait=0), pending timer is not scheduled
in fact;
7) In throtl_upgrade_state it totally dispatches 32 queued bios and with
32 left. test1 and test2 each has 16 queued bios;
8) throtl_pending_timer_fn sees the left over bios, but could do
nothing, because throtl_select_dispatch returns 0, and test1/test2 has
no pending tg.
The blktrace shows the following:
8,32 0 0 2.539007641 0 m N throtl upgrade to max
8,32 0 0 2.539072267 0 m N throtl /test2 dispatch nr_queued=16 read=0 write=16
8,32 7 0 2.539077142 0 m N throtl /test1 dispatch nr_queued=16 read=0 write=16
So force schedule dispatch if there are pending children.
Signed-off-by: Joseph Qi <qijiang.qj@alibaba-inc.com>
---
block/blk-throttle.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/blk-throttle.c b/block/blk-throttle.c
index 0fea76a..17816a0 100644
--- a/block/blk-throttle.c
+++ b/block/blk-throttle.c
@@ -1911,11 +1911,11 @@ static void throtl_upgrade_state(struct throtl_data *td)
tg->disptime = jiffies - 1;
throtl_select_dispatch(sq);
- throtl_schedule_next_dispatch(sq, false);
+ throtl_schedule_next_dispatch(sq, true);
}
rcu_read_unlock();
throtl_select_dispatch(&td->service_queue);
- throtl_schedule_next_dispatch(&td->service_queue, false);
+ throtl_schedule_next_dispatch(&td->service_queue, true);
queue_work(kthrotld_workqueue, &td->dispatch_work);
}
--
1.9.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] blk-throttle: fix possible io stall when upgrade to max
2017-09-30 6:38 [PATCH v2] blk-throttle: fix possible io stall when upgrade to max Joseph Qi
2017-09-30 6:02 ` Shaohua Li
@ 2017-10-03 21:42 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2017-10-03 21:42 UTC (permalink / raw)
To: Joseph Qi, linux-block; +Cc: Shaohua Li, boyu.mt, wenqing.lz, qijiang.qj
On 09/30/2017 12:38 AM, Joseph Qi wrote:
> From: Joseph Qi <qijiang.qj@alibaba-inc.com>
>
> There is a case which will lead to io stall. The case is described as
> follows.
> /test1
> |-subtest1
> /test2
> |-subtest2
> And subtest1 and subtest2 each has 32 queued bios already.
>
> Now upgrade to max. In throtl_upgrade_state, it will try to dispatch
> bios as follows:
> 1) tg=subtest1, do nothing;
> 2) tg=test1, transfer 32 queued bios from subtest1 to test1; no pending
> left, no need to schedule next dispatch;
> 3) tg=subtest2, do nothing;
> 4) tg=test2, transfer 32 queued bios from subtest2 to test2; no pending
> left, no need to schedule next dispatch;
> 5) tg=/, transfer 8 queued bios from test1 to /, 8 queued bios from
> test2 to /, 8 queued bios from test1 to /, and 8 queued bios from test2
> to /; note that test1 and test2 each still has 16 queued bios left;
> 6) tg=/, try to schedule next dispatch, but since disptime is now
> (update in tg_update_disptime, wait=0), pending timer is not scheduled
> in fact;
> 7) In throtl_upgrade_state it totally dispatches 32 queued bios and with
> 32 left. test1 and test2 each has 16 queued bios;
> 8) throtl_pending_timer_fn sees the left over bios, but could do
> nothing, because throtl_select_dispatch returns 0, and test1/test2 has
> no pending tg.
>
> The blktrace shows the following:
> 8,32 0 0 2.539007641 0 m N throtl upgrade to max
> 8,32 0 0 2.539072267 0 m N throtl /test2 dispatch nr_queued=16 read=0 write=16
> 8,32 7 0 2.539077142 0 m N throtl /test1 dispatch nr_queued=16 read=0 write=16
>
> So force schedule dispatch if there are pending children.
Applied for 4.14, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-03 21:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-30 6:38 [PATCH v2] blk-throttle: fix possible io stall when upgrade to max Joseph Qi
2017-09-30 6:02 ` Shaohua Li
2017-10-03 21:42 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.