* [PATCH] io_uring: update sq_thread_idle after ctx deleted
@ 2021-04-24 9:26 Hao Xu
2021-04-25 0:03 ` Pavel Begunkov
2021-04-25 16:15 ` Jens Axboe
0 siblings, 2 replies; 4+ messages in thread
From: Hao Xu @ 2021-04-24 9:26 UTC (permalink / raw)
To: Jens Axboe; +Cc: io-uring, Pavel Begunkov, Joseph Qi
we shall update sq_thread_idle anytime we do ctx deletion from ctx_list
Fixes:734551df6f9b ("io_uring: fix shared sqpoll cancellation hangs")
Signed-off-by: Hao Xu <[email protected]>
---
fs/io_uring.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 40f38256499c..15f204274761 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8867,6 +8867,7 @@ static void io_sqpoll_cancel_cb(struct callback_head *cb)
if (sqd->thread)
io_uring_cancel_sqpoll(sqd);
list_del_init(&work->ctx->sqd_list);
+ io_sqd_update_thread_idle(sqd);
complete(&work->completion);
}
@@ -8877,7 +8878,6 @@ static void io_sqpoll_cancel_sync(struct io_ring_ctx *ctx)
struct task_struct *task;
io_sq_thread_park(sqd);
- io_sqd_update_thread_idle(sqd);
task = sqd->thread;
if (task) {
init_completion(&work.completion);
@@ -8886,6 +8886,7 @@ static void io_sqpoll_cancel_sync(struct io_ring_ctx *ctx)
wake_up_process(task);
} else {
list_del_init(&ctx->sqd_list);
+ io_sqd_update_thread_idle(sqd);
}
io_sq_thread_unpark(sqd);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] io_uring: update sq_thread_idle after ctx deleted
2021-04-24 9:26 [PATCH] io_uring: update sq_thread_idle after ctx deleted Hao Xu
@ 2021-04-25 0:03 ` Pavel Begunkov
2021-04-25 9:52 ` Hao Xu
2021-04-25 16:15 ` Jens Axboe
1 sibling, 1 reply; 4+ messages in thread
From: Pavel Begunkov @ 2021-04-25 0:03 UTC (permalink / raw)
To: Hao Xu, Jens Axboe; +Cc: io-uring, Joseph Qi
On 4/24/21 10:26 AM, Hao Xu wrote:
> we shall update sq_thread_idle anytime we do ctx deletion from ctx_list
looks good, a nit below
>
> Fixes:734551df6f9b ("io_uring: fix shared sqpoll cancellation hangs")
> Signed-off-by: Hao Xu <[email protected]>
> ---
> fs/io_uring.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 40f38256499c..15f204274761 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -8867,6 +8867,7 @@ static void io_sqpoll_cancel_cb(struct callback_head *cb)
> if (sqd->thread)
> io_uring_cancel_sqpoll(sqd);
> list_del_init(&work->ctx->sqd_list);
> + io_sqd_update_thread_idle(sqd);
> complete(&work->completion);
> }
>
> @@ -8877,7 +8878,6 @@ static void io_sqpoll_cancel_sync(struct io_ring_ctx *ctx)
> struct task_struct *task;
>
> io_sq_thread_park(sqd);
> - io_sqd_update_thread_idle(sqd);
> task = sqd->thread;
> if (task) {
> init_completion(&work.completion);
> @@ -8886,6 +8886,7 @@ static void io_sqpoll_cancel_sync(struct io_ring_ctx *ctx)
> wake_up_process(task);
> } else {
> list_del_init(&ctx->sqd_list);
> + io_sqd_update_thread_idle(sqd);
Not actually needed, it's already dying.
> }
> io_sq_thread_unpark(sqd);
>
>
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] io_uring: update sq_thread_idle after ctx deleted
2021-04-25 0:03 ` Pavel Begunkov
@ 2021-04-25 9:52 ` Hao Xu
0 siblings, 0 replies; 4+ messages in thread
From: Hao Xu @ 2021-04-25 9:52 UTC (permalink / raw)
To: Pavel Begunkov, Jens Axboe; +Cc: io-uring, Joseph Qi
在 2021/4/25 上午8:03, Pavel Begunkov 写道:
> On 4/24/21 10:26 AM, Hao Xu wrote:
>> we shall update sq_thread_idle anytime we do ctx deletion from ctx_list
>
> looks good, a nit below
>
>>
>> Fixes:734551df6f9b ("io_uring: fix shared sqpoll cancellation hangs")
>> Signed-off-by: Hao Xu <[email protected]>
>> ---
>> fs/io_uring.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/io_uring.c b/fs/io_uring.c
>> index 40f38256499c..15f204274761 100644
>> --- a/fs/io_uring.c
>> +++ b/fs/io_uring.c
>> @@ -8867,6 +8867,7 @@ static void io_sqpoll_cancel_cb(struct callback_head *cb)
>> if (sqd->thread)
>> io_uring_cancel_sqpoll(sqd);
>> list_del_init(&work->ctx->sqd_list);
>> + io_sqd_update_thread_idle(sqd);
>> complete(&work->completion);
>> }
>>
>> @@ -8877,7 +8878,6 @@ static void io_sqpoll_cancel_sync(struct io_ring_ctx *ctx)
>> struct task_struct *task;
>>
>> io_sq_thread_park(sqd);
>> - io_sqd_update_thread_idle(sqd);
>> task = sqd->thread;
>> if (task) {
>> init_completion(&work.completion);
>> @@ -8886,6 +8886,7 @@ static void io_sqpoll_cancel_sync(struct io_ring_ctx *ctx)
>> wake_up_process(task);
>> } else {
>> list_del_init(&ctx->sqd_list);
>> + io_sqd_update_thread_idle(sqd);
>
> Not actually needed, it's already dying.
>
Yep, we could keep it since it's not in hot path.
>> }
>> io_sq_thread_unpark(sqd);
>>
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] io_uring: update sq_thread_idle after ctx deleted
2021-04-24 9:26 [PATCH] io_uring: update sq_thread_idle after ctx deleted Hao Xu
2021-04-25 0:03 ` Pavel Begunkov
@ 2021-04-25 16:15 ` Jens Axboe
1 sibling, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2021-04-25 16:15 UTC (permalink / raw)
To: Hao Xu; +Cc: io-uring, Pavel Begunkov, Joseph Qi
On 4/24/21 3:26 AM, Hao Xu wrote:
> we shall update sq_thread_idle anytime we do ctx deletion from ctx_list
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-25 16:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-24 9:26 [PATCH] io_uring: update sq_thread_idle after ctx deleted Hao Xu
2021-04-25 0:03 ` Pavel Begunkov
2021-04-25 9:52 ` Hao Xu
2021-04-25 16:15 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox