Re: bug in futex.2, FUTEX_CMP_REQUEUE
From: Carlos O'Donell <hidden>
Date: 2025-05-27 12:29:08
On 5/27/25 8:21 AM, Jₑₙₛ Gustedt wrote:
Hello Carlos, On Tue, 27 May 2025 07:30:09 -0400, Carlos O'Donell wrote:quoted
quoted
This has several issues, the most severe beeing the word `FUTEX_WAIT`. - How can an operation that only does wakes, ever be equivalent to a wait?My opinion is that the text is correct. The operation can WAKE tasks. The operation can also cause tasks to WAIT in a *different* queue.No, it can make *other* threads wait in a different queue. The `FUTEX_WAIT` call is to put the current thread on wait. So calling this equivalent is really far fetched.
Sorry, I'm not sure what you're saying "No" to in this case. I wrote that it can cause tasks to wait in a different queue, but you wrote threads. Threads are really a userspace construct, while the Linux kernel is really only aware tasks that have properties, so I tend to call them tasks when speaking about the kernel tasks. The text in question is parenthetical, and is correct for a val==0 API call, where zero waiters are woken, but for which up to val2 waiters are "moved" (atomic WAKE/WAIT into uaddr2). While you call it "far fetched" is a parenthetical side comment that is correct for the odd corner case of val==0? -- Cheers, Carlos.