![]() |
|
Message-ID: <aLpalVB2apB21r3g@voyager> Date: Fri, 5 Sep 2025 05:35:49 +0200 From: Markus Wichmann <nullplan@....net> To: Rich Felker <dalias@...c.org> Cc: musl@...ts.openwall.com Subject: Re: ABA problem in aio_suspend() Am Thu, Sep 04, 2025 at 03:42:20PM -0400 schrieb Rich Felker: > We generally don't do generation counters like this that are clearly > logically incorrect and just rely on "it's going to wake before > something that could plausibly happen happens". You think oversleeping for *exactly* 2^31 updates is plausible? > I think the "obvious" > way to make it correct is not to allow keeping an existing waiter's > tid in the futex, but always putting one's own tid there. However this > can create high contention on the futex, perhaps unboundedly so with a > lot of threads/cores. That's probably why I tried to just use an > existing waiter tid. > This seems like it can create a livelocking situation, where two threads calling aio_suspend() keep overwriting the other thread's TID before the other thread can go to sleep. > The obvious way you'd *want* to make it correct is with a condvar, but > this can't be done because aio_suspend is required to be AS-safe, and > thus cannot use locks, at least not without a lot of care. And it > can't do anything like having the waiter join a userspace wait queue, > since the AS-safety of aio_suspend means it's legal to longjmp out of > it. > And the process-shared code for condvars uses a generation counter. So there's another example of it in use. Ciao, Markus
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.