Re: Potential deadlock in pgaio_io_wait()
От | Thomas Munro |
---|---|
Тема | Re: Potential deadlock in pgaio_io_wait() |
Дата | |
Msg-id | CA+hUKGJhZLeNE8oDJKQC6n=9g44=54qf18sSF8zj6kfTBf-9Ow@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Potential deadlock in pgaio_io_wait() (Thomas Munro <thomas.munro@gmail.com>) |
Ответы |
Re: Potential deadlock in pgaio_io_wait()
|
Список | pgsql-hackers |
I discussed this off-list with Andres who provided the following review: * +1 for the analysis * +1 for the solution * his benchmark machine shows no regression under heavy IO submission workload * needs better comments I had expected that patch to be rejected as too slow. I was thinking that it should be enough to insert a memory barrier and then do an unlocked check for an empty waitlist in ConditionVariableBroadcast() to avoid a spinlock acquire/release. That caused a few weird hangs I didn't understand, which is why I didn't post that version last time, but he pointed out that the other side also needs a memory barrier in ConditionVariablePrepareToSleep() and the existing spinlock acquire/release is not enough. Still processing that, but given that ConditionVariableBroadcast() performance is already sufficient, there is no need for fancy tricks for this problem and my "naive" patch is actually fine. So here's a version that just adds some comments and corrects a minor thinko. I also thought of a small optimisation, presented in the -B patch. It's a bit of a shame to wait for backend->submit_cv and then also ioh->cv in io_method=worker. It's just a bunch of IPC ping-pong for nothing. So I figured it should be allowed to fall all the way through based on its lack of ->wait_one. Worth bothering with? On a superficial note: AIO_IO_COMPLETION "Waiting for another process to complete IO." +AIO_IO_SUBMIT "Waiting for another process to submit IO." AIO_IO_URING_SUBMIT "Waiting for IO submission via io_uring." AIO_IO_URING_EXECUTION "Waiting for IO execution via io_uring." We're inconsistent in our choice of noun or verb. I went with _SUBMIT to match the following line, rather than _SUBMISSION to match the preceding line. Shrug.
Вложения
В списке pgsql-hackers по дате отправления: