On Fri, Apr 7, 2023 at 1:37 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > I'd like to mention completions as an alternative to semaphores, but > can't figure out a nice way to fit that in. I'm personally a bit sorry completions ever became a thing. There's a real reason for having them, but they have been used and mis-used in so many confusing ways that I am worried every time I see a completion. We've had some nasty use of 'init_completion()' in particular. There are many obvious uses of completions, and they have nice strict semantics wrt last-use etc (so that you can put them on the stack and know that you're the last user when you return, which is not necessarily true of locking in general). But there are several less-than-obvious uses too, and any use of reinit_completion() ends up just making me go "Uhh". The serialization needed for that to actually work right often means that you might as well have used a "wait_event()" with a "smp_store_release()" variable instead and made the code more obvious. I dunno. I might have had a few bad experiences and it's just rare enough to be one of those things that I feel wasn't worth the abstraction cost. And I can't even blame anybody else. I think I'm to blame for that horror. Linus