Re: [PATCH 4/6] io_uring: switch normal task_work to a mpscq

Jens Axboe <[email protected]>
Newsgroups org.kernel.vger.io-uring
Message-ID <[email protected]>
On 6/12/26 12:59 PM, Caleb Sander Mateos wrote:
>> @@ -236,10 +262,14 @@ void io_req_normal_work_add(struct io_kiocb *req)
>>                 return;
>>         }
>>
>> +       /* task_work must only be added once */
>> +       if (test_and_set_bit(0, &tctx->tw_pending))
>> +               return;
> 
> Is tw_pending necessary? How come the task_work_add() exclusivity
> isn't already provided by the mpscq_push() check above?

It is, because the transition from empty -> not-empty no longer works
for that, as the mpscq emtpies one-by-one rather than with a delete-all
kind of primitive.

I missed that originally and things blew up spectacularly very quickly
:-)

-- 
Jens Axboe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.